This is a migrated thread and some comments may be shown as answers.

[Solved] Grouping Grid Client side

5 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gabe
Top achievements
Rank 1
Gabe asked on 12 May 2011, 10:15 PM
Is there anyway to handle grid grouping on the client side?

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 May 2011, 07:27 AM
Hello Gabe,

 I am not sure what you mean. Could you please clarify?

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Gabe
Top achievements
Rank 1
answered on 13 May 2011, 10:45 PM
I am binding data like this....

 var grid = $('#' + gridid).data('tGrid');
        grid.dataBind(data.Data);

So this causes the grouping to not work properly now, so I thought this was caused by handling the data binding in a client side ajax call. So I was wondering what the proper way to handle grouping would be...
0
Atanas Korchev
Telerik team
answered on 14 May 2011, 09:33 AM
Hello Gabe,

 Unfortunately grouping will not work in this case. It will work if you use only ajax, server or web service binding via the DataBinding configuration.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Gabe
Top achievements
Rank 1
answered on 16 May 2011, 08:42 PM
SO I have changed my grid to use Ajax binding.
I wanted to pass in some additional params to the binding Action. So I added a client event to the grid and then added some params to the data object. This worked. In my action I now have access to the custom params. The only thing I can't figure out is OnDataBound getting access to the returned object so I can access the updated value of the custom params and update a couple of hidden filed accordingly. 

So I created a derived class of GridModel that has one extra parameter to test this with. The only thing I don't see is how to get access to the return object from the Ajax call. I thought I could trap it in OnDataBound.

.EnableCustomBinding(true)
.DataBinding(d => d.Ajax().Select("_AjaxBinding""Home"))
.ClientEvents(e => {
    e.OnDataBinding("mydatabind");    
    e.OnDataBound("mydatabound");
})

My JS function:

function mydatabind(e){
   e.data = 
   { 
      testparam: 'testing123'                     
   };
}

My Action:

[GridAction]
public ActionResult _AjaxBinding(GridCommand command, string testingparam)
{
   // get data here...   
return
 View(new GridModelExt { Data = GetData(command, testingparam), Total = 50, TestParam = DateTime.Now.ToString() }); }

I create a derived class for GridModel that looks like this:

public class GridModelExtGridModel
{
   public string TestParam { getset; }
}


function mydatabound(e){
    // access object here to get updated TestParam value
}
0
Atanas Korchev
Telerik team
answered on 17 May 2011, 06:52 AM
Hi Gabe,

 I am afraid this is not currently supported. The GridAction attribute sends only the following fields during ajax binding:

{
       data: [],     // array of records
       modeState, //model state errors if any
       total: 100 // total number of records
}

This effectively disables sending custom fields during grid data binding. 

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Gabe
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Gabe
Top achievements
Rank 1
Share this question
or