Search code examples
kendo-uiodatakendo-datasource

Kendo UI DataSource filtering using OData v4 lambda operators


I would like to filter Kendo DataSource using the OData v4 lambda operators any and all.

I haven't been able to find any information on how to achieve this using the dataSource.filter property. I can filter the DataSource by injecting the filter in the URL like this:

dataSource.transport.read.data.$filter = "Clients/any(c:c/Id eq 1)"

But this isn't practical in my case. What I am looking for is a way to declare the filter similar to this:

filter: { field: 'Clients/Id', operator: 'any', value: 1 }

Does Kendo UI even support OData lambda operators in the current version?


Solution

  • There is no such support presently. This is from the documentation:

    filter.operator String

    The filter operator (comparison). The supported operators are: "eq" (equal to), "neq" (not equal to), "lt" (less than), "lte" (less than or equal to), "gt" (greater than), "gte" (greater than or equal to), "startswith", "endswith", "contains". The last three are supported only for string fields.

    I also tried it myself and it doesn't work, you can start the example and observe the network requests you will notice that the requests to the server do not include the custom operators, if you switch to client filtering you will get an error. So it wouldn't work, at least for now.

    http://dojo.telerik.com/areXe

    By the way why would you need such filtering? If you really need such filtering you can extend the grid and override the filter including your custom operators, I have seen examples here but didn't do it myself. I have been extending other widgets though.