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

Grid sorting error

2 Answers 224 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Szilard
Top achievements
Rank 1
Szilard asked on 30 Mar 2012, 12:03 PM
Hello,

I have a sortable grid that's bound to a kendo dataSource with the following transport configuration:
transport: {
   read: {
      url: "http://localhost/myJsonService",
      dataType: "json",
   },
   parameterMap: kendo.data.transports.odata.parameterMap
}

Everything works fine when I'm sorting a column in ascending/descending order, but when I click on the column the third time (to disable sorting), the URL sent out towards the server is malformed : ...?%24format=json&%24inlinecount=allpages&%24top=5&%24orderby= which causes the server to fail.
This seems to be caused by the orderby= still being present, even though no sorting is applied. Is there any way of bypassing this without having to modify the sort function given in line 1542 of the unminified kendo.all.min.js not to assign the $orderby property when no actual data is present?

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 03 Apr 2012, 03:25 PM
Hello Szilard,

Indeed this is true. We will fix it. As a workaround you will have to make the parameterMap a function, call the kendo.data.transports.odata.parameterMap inside it and remove the $orderby field from the result if empty string.

Greetings,
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
Szilard
Top achievements
Rank 1
answered on 10 Apr 2012, 02:03 PM
Thanks, that did the trick, and is a lot less messy than modifying the minified kendo sources!

For anyone interested, the resulting parameterMap looks the following way:

parameterMap: function(options, type) {
    var params = kendo.data.transports.odata.parameterMap(options, type);
    if (!params.$orderby) {
        delete params.$orderby;             
    }
    return params;
}


Regards,
Szilard
Tags
Grid
Asked by
Szilard
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Szilard
Top achievements
Rank 1
Share this question
or