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

Custom grid filter operator problem

2 Answers 358 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 28 Apr 2016, 02:45 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 29 Apr 2016, 02:12 PM
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!
 
0
Andrew
Top achievements
Rank 1
answered on 02 May 2016, 04:44 AM

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

Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or