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

GRID - Sorting at the server

4 Answers 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Agnes
Top achievements
Rank 1
Agnes asked on 19 Dec 2011, 06:08 AM
Hi,
I set the sortable attribute to true, and the serverSorting: true for a kendo grid. json is of type POST. When I used Firebug to check the value of the sort expression, it was something like below
sort[0][dir]: asc
sort[0][field]: customerName.
And I tried to map to asp.net mvc model at the server.I could not get value through to the model. I already included this line in the global.asax
ValueProviderFactories.Factories.Add(new JsonValueProviderFactory());
It could map all other fields, but not the above sorting stuff.
Hence, I could not manage the sorting at the server.

Please help....
Thanks,
Agnes

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 19 Dec 2011, 12:39 PM
Hello Agnes,

You will need to serialize the parameters in a form in which can be parsed on the server. To manipulate the format in which the parameters are send you can provide custom implementation of the parameterMap function of the transport in the DataSource.

The simplest implementation for this is to send well format JSON to server method, i.e:
parameterMap: function(options) {
 return JSON.stringify(options);
}

For your convenience I am attaching sample application.

Best wishes,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Agnes
Top achievements
Rank 1
answered on 19 Dec 2011, 10:34 PM
Hi Nikolay,
It works perfectly!

Many thanks,
Agnes
0
Guillermo
Top achievements
Rank 2
answered on 07 Mar 2012, 10:49 PM
Doesn't work in MVC, i just downloaded the code and debug the solution, the controller  List<SortDescriptor>  object is null.
0
Guillermo
Top achievements
Rank 2
answered on 08 Mar 2012, 04:04 PM
Ok, i got it...the first load is not sorted, but the second it's ok. Working great. Thanks!
Tags
Grid
Asked by
Agnes
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Agnes
Top achievements
Rank 1
Guillermo
Top achievements
Rank 2
Share this question
or