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

Serverside Filtering Criteria Parsing

1 Answer 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 01 Nov 2012, 02:47 PM
When doing server-side paging, I am receiving results from the query string that are confusing.
The documentation for the web control grids server-side paging does not list all of the items that show up in the query string.

For instance there are keys that appear with nested filters:

filter[filters][0][filters][1][field]

and some that are not nested:

filter[filters][1][field]

There is a logical on the first level, that shows up regardless: filter[logic]
but there are also logicals that show up on other levels.

Sometimes the first columns sorting is on the first level, sometimes on the second level of nesting.

1.Is there any documentation available, that describes what the filters query string structure represents, so we can parse it and make SQL statements accordingly?
 http://docs.kendoui.com/api/framework/datasource#serverfiltering  is all I have found so far, and it is not complete.

2. If there is not documentation available, has anyone successfully parsed this data in such a way that works for all cases of multiple columns, some with one filter, two filters, and zero filters?

3. The same filters give different results, if the operator in the first column never gains focus (if you leave it on and, but enter criteria for second filter on first column). Can we assume this is a bug with the control, and can we assume this is only for the first column?

Thank you


***Update***:
 I parsed based on recurring pattern which is assuming #3 above is a special case and seems to be working ok. For anyone else trying to parse serverside filters for the grid control you can assume that all but the first column are in format:

one filter on a column: filter[filters][X][field] where X is column #
two filters on a column: filter[filters][X][filters][Y][field] where X is col # and Y is filter #

for first column see #3 above, you can make special case for that one in your parser.

Even though i got it working for me, I am still interested to see the documentation when it is updated, thanks!

1 Answer, 1 is accepted

Sort by
0
pucsoftware
Top achievements
Rank 1
answered on 09 Nov 2012, 03:26 PM
I agree the documentation on this is sparse and I too am looking for an example. The only one I've seen involves capturing the entire Request as a defined type and de-serializing it into an object. This would mean having to create a different object where for each time I used a grid. Seems unnecessary. I'd like to just come up with a function that only processes these array types and handle the rest of the Request seperately. I've tried using the Request["filter"] and getting the string value of this but it doesn't seem to work. Please Telerik reply on how this can be done with an example.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
pucsoftware
Top achievements
Rank 1
Share this question
or