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

"OR" logic in grid filter

1 Answer 345 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adrenaline Junkie
Top achievements
Rank 1
Adrenaline Junkie asked on 23 Mar 2013, 01:43 PM
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

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 25 Mar 2013, 03:24 PM
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!
Tags
Grid
Asked by
Adrenaline Junkie
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or