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

Server side filtering and parsing the filter

1 Answer 824 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
DJo
Top achievements
Rank 1
DJo asked on 03 Apr 2013, 10:05 PM
I'm trying to build as general a grid as possible. It has a dataSource that uses server side paging, sorting, and filtering. It all works great, at least until the server gets a request from the dataSource and has a hard time figuring out the query that it should execute.

The web server is running .NET, so the dataSource uses web methods to exchange data with the data server via a SqlConnection. The dataSource stringifies all the options very nicely but I can't come up with a general solution for how to write parameters for my web methods that can take a variety of filtering cases.

The simplest case is... simple. Without any filtering or sorting the web method just handles the paging parameters. No problems there.

Adding filtering to the mix, or even doing filtering without any other parameters, is tough. Looking at the JSON that the dataSource sends to the web server, I gather that the filter argument can be complicated. It can be a list of filters and an operation, or a list of lists of filters and operations and filters and operations, yadda yadda yadda. I've attached a tree view of a sample JSON request showing the nested filters; this is a simple case relative to what my grid will eventually have to do.

It almost looks like I need to handle each case explicitly on the server, rather than being able to write a generic filter object that will take any filter parameter sent by the dataSource. That kind of sucks. I have no problem getting the filter out in a particular case (that would be easy) but I can't seem to design a generic object that will take the filter parameter in any case.

Any help on how to represent a filter on the server in the most general case?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Apr 2013, 02:25 PM
Hello David,

Please notice that if the format in which the sort/filter/group descriptors are sent is not convenient enough for you, you can use the parameterMap function to re-map the parameters and thus send them in different format.

http://docs.kendoui.com/api/framework/datasource#configuration-transport.parameterMap

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
DJo
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or