How to filter a datasource

2 posts, 0 answers
  1. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 07 Feb 2012 Link to this post

    Hi,

    Let us say I have a dataSource with 2 columns: Name and Contact.
    Now I have a searchValue on which I want to filter the dataSource with this expression: "Name == searchValue || Contact == searchValue".
    How should I do that? Can't find documentation on that, only about simpel single field filters.
    I use this to filter on one field:
    dataSource.query({ filter: { field: "Name", operator: "contains", value: searchValue} }); 

    But how should I do that with an "or" filter on a second field?
    And is possible to use an expression?

    Regards, Jaap
  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 07 Feb 2012 Link to this post

    Hello Jaap,

    In order to construct an OR filter expression you should use similar to the following syntax:

    {
        logic: "or",
        filters: [
           { field: "Name", operator: "contains", value: searchValue },
           { field: "Contact", operator: "contains", value: searchValue }
        ]
    }

    All the best,
    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. Kendo UI is VS 2017 Ready
Back to Top