Data Source Filter - Negation

4 posts, 0 answers
  1. Bill
    Bill avatar
    5 posts
    Member since:
    Jan 2013

    Posted 22 Feb 2013 Link to this post

    Is negation in the filter supported?

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

    Posted 25 Feb 2013 Link to this post

    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!
  3. Bill
    Bill avatar
    5 posts
    Member since:
    Jan 2013

    Posted 25 Feb 2013 Link to this post

    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
  4. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 26 Feb 2013 Link to this post

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