Server side filtering and parsing the filter

2 posts, 0 answers
  1. DJo
    DJo avatar
    23 posts
    Member since:
    Nov 2012

    Posted 03 Apr 2013 Link to this post

    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?
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 05 Apr 2013 Link to this post

    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.

    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!
Back to Top