5 Answers, 1 is accepted
0
Hello Gabe,
Atanas Korchev
the Telerik team
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....
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...
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
Hello Gabe,
Atanas Korchev
the Telerik team
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.
My JS function:
My Action:
I create a derived class for GridModel that looks like this:
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 GridModelExt : GridModel { public string TestParam { get; set; } }
function mydatabound(e){ // access object here to get updated TestParam value }
0
Hi Gabe,
Atanas Korchev
the Telerik team
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.
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