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

Compare Kendo filters

1 Answer 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pascale
Top achievements
Rank 1
Pascale asked on 30 May 2016, 07:38 PM
Hello,

Currently, is there a way to compare Kendo filters?

Example of equalities:
* {"logic":"and","filters":[{"value":"abc","operator":"eq","field":"type"},{"value":"xyz","operator":"eq","field":"model"}]}
* {"logic":"and","filters":[{"logic":"or","filters":[{"value":"abc","operator":"eq","field":"type"}]},{"value":"xyz","operator":"eq","field":"model"}]}
* {"logic":"and","filters":[{"logic":"or","filters":[{"value":"abc","operator":"eq","field":"type"}]},{"logic":"or","filters":[{"value":"xyz","operator":"eq","field":"model"}]}]}
* {"logic":"and","filters":[{"value":"abc","operator":"eq","field":"type"},{"logic":"or","filters":[{"value":"xyz","operator":"eq","field":"model"}]]}}
* {"logic":"and","filters":[{"value":"xyz","operator":"eq","field":"model"},{"value":"abc","operator":"eq","field":"type"}]}
* ...

There are many ways that Kendo generate equal filter queries (such as the "Clear" button). However, I did not find a way to compare...

Thanks,
Pascale Audet

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 02 Jun 2016, 07:06 AM
Hello Pascale,

In general, the best way to compare filters is to perform a deep manual comparison of the filter expressions.

The kendo.data.Query exposes a method that could be sufficient to check for changes in the filter state, but please note that it doesn't perform a sophisticated (does not check particular filter expressions) comparison and it could not work in all possible cases.

Here is a link to the implementation of the method:
Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Pascale
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or