Custom grid filter operator problem

3 posts, 1 answers
  1. Andrew
    Andrew avatar
    6 posts
    Member since:
    May 2014

    Posted 27 Apr 2016 Link to this post

    Hi,

    I’m getting some unexpected query parameters passed back to the server when redefining some of the grid’s filter operators.

    For example, if I customize the filter operators with the following:

    filterable: {
          operators: {
            string: {
              "Contains": "Contains",
              "DoesNotContain": "Does not contain",
              "Equals": "Is equal to",
              "DoesNotEqual": "Is not equal to",
              "StartsWith": "Starts with",
              "EndsWith": "Ends with"
            }
          }
        },

    I would then expect one of the query parameters to be the following when using the “Equals” operator.

    filter[filters][0][operator]=Equals

    However, instead it sends the standard equals operator:

    filter[filters][0][operator]=eq

    The behaviour is as I’d expect for the other operators. e.g.

    filter[filters][0][operator]=StartsWith

    I only experience the problem with the equals, greater than and less than operators.

    Here is a jsfiddle demonstrating the problem. Of course the filters don’t actually work as the server side code doesn't support the custom operators. You need to look at the requests sent to the server to see the problem.

    https://jsfiddle.net/snowman611/6mnzbc1e/3/

    Has anyone else had this problem? What am I doing wrong?

    Thanks,

    Andrew

  2. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2203 posts

    Posted 29 Apr 2016 Link to this post

    Hi Andrew,

    The described setup is not supported and the behavior that you observe for operators other than "equal to" is a side effect. Could you please provide more information about where did you find the mentioned example? I would suggest to check the Grid API for the available "operators.string" options and update your project accordingly (these options are case sensitive):

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Andrew
    Andrew avatar
    6 posts
    Member since:
    May 2014

    Posted 01 May 2016 in reply to Vladimir Iliev Link to this post

    Thanks Vladimir. I have updated my code accordingly as suggested.

    I'm afraid I originally wrote the affected code well over a year ago, and had a workaround in place. I have only just got around to investigating the inconsistency. I can't recall whether I saw an example or whether I just came up with the code by trial and error.

    Thanks for your help.

    Andrew

Back to Top