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

Data Source Filter - Negation

3 Answers 209 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 22 Feb 2013, 06:06 PM
Is negation in the filter supported?

I need to do something on the lines of:
dataSource.filter({ field: "firstname", operator: "not startswith", value: "foo" });

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Feb 2013, 08:54 AM
Hello Bill,

I'm afraid that this is not supported. The list of supported operators can be found here. However, if you are not using the server filtering you may assign a custom function as operator, which to handle this comparison. Here is a simple test page. If you are using server filtering, you should handle the filtering manually there.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bill
Top achievements
Rank 1
answered on 25 Feb 2013, 04:23 PM
Hi Rosen,

I'm using the odata datasource, so while I do use server filtering, I can't handle it on the server side unless the Odata DataSource generates a proper filter query string.  Currently, if I use an unsupported filter operator, it just generates an empty filter, i.e., "$filter=".  Is there anyway I can customize the query string?  If I can change it to:
$filter=not startswith(firstname,'foo')
Then my OData service will take care of it properly.

Also, in Kendo Grid's built-in column filters, there is an option to filter by "Does not contain", and it does not work.  It will produce an empty filter query string as well.  This behavior is also evident on the grid demo.

-Bill
0
Rosen
Telerik team
answered on 26 Feb 2013, 08:39 AM
Hi Bill,

As I have mentioned this is not supported. The only way to add support for this using OData is to modify the source code of the kendo.data.odata.js. However, note that modification of the source code are nit supported.

Regarding, the issue with the "Does not contain" option not working with OData. This is a known problem which has been already fixed.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Bill
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Bill
Top achievements
Rank 1
Share this question
or