"OR" logic in grid filter

2 posts, 0 answers
  1. Adrenaline Junkie
    Adrenaline Junkie avatar
    1 posts
    Member since:
    Dec 2011

    Posted 23 Mar 2013 Link to this post

    How do you apply filters (via javascript) and specify that it should be OR logic.

    forexample.  I have a grid with baseball players and a dropdown that contains values to filter by.  There are some vanity names for logical groupings.  Batters, Pitchers, etc.  There are only 4 types of pitchers so it would be easier to issue position=='P' or position='PS' or position='SP' or position='RP'

    j
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2284 posts

    Posted 25 Mar 2013 Link to this post

    Hello Jason,


    You could apply the filters manually with the filter method of the Grid dataSource.
    E.g.
    var grid = $("#Grid").data("kendoGrid");
    grid.dataSource.filter({
        logic: "or",
        filters: [
          { field: "position", operator: "eq", value: "P" },
          { field: "position", operator: "eq", value: "PS" },
          { field: "position", operator: "eq", value: "SP" },
          { field: "position", operator: "eq", value: "RP" }
        ]
    });

    Wish you a great day!

     

    All the best,
    Dimiter Madjarov
    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