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

What operoation is equal to the sql "in" when I filter the string in grid?

3 Answers 254 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PEIYANG
Top achievements
Rank 1
PEIYANG asked on 14 Apr 2013, 06:54 AM
For example ,I want to find the object that its id in "101,1011,1001'  and  name  "Lucy" called filterstring.Need I have to filter 3 times?
  $("#Grid").data("kendoGrid").dataSource.filter([
      { field: "id", operator: "eq", value: "101"},
{ field: "id", operator: "eq", value: "1001"},
{ field: "id", operator: "eq", value: "1001"}
{ field: "name", operator: "eq", value: "Lucy"}
                   ]);

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 Apr 2013, 07:32 AM
Hello,

 The Kendo DataSource doesn't provide an equivalent to the "in" SQL operator. All supported operators are listed here: http://docs.kendoui.com/api/framework/datasource#configuration-filter.operator

 You can use an "or" filter in your case:

dataSource.filter( {
    logic: "or",
    filters: [
       { field: "id", operator: "eq", value: "101"},
       { field: "id", operator: "eq", value: "1001"},
       { field: "id", operator: "eq", value: "1001"},
       { field: "name", operator: "eq", value: "Lucy"}
    ]
});

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
PEIYANG
Top achievements
Rank 1
answered on 15 Apr 2013, 12:44 PM
Thanks,Atanas Korchev,It seems that the Kendo DataSource also not provide an equivalent to the "Like" SQL operator? It is right?
0
Accepted
Atanas Korchev
Telerik team
answered on 15 Apr 2013, 01:08 PM
Hello,

 All supported filter operators are listed in the documentation. Here is a quote:

The supported operators are: "eq" (equal to), "neq" (not equal to), "lt" (less than), "lte" (less than or equal to), "gt" (greater than), "gte" (greater than or equal to), "startswith", "endswith", "contains". The last three are supported only for string fields.

Regards,
Atanas Korchev
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
PEIYANG
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
PEIYANG
Top achievements
Rank 1
Share this question
or