Compare Kendo filters

2 posts, 0 answers
  1. Pascale
    Pascale avatar
    2 posts
    Member since:
    Jan 2016

    Posted 30 May 2016 Link to this post

    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
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 01 Jun 2016 Link to this post

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