Hi Kendo team,
I have a page with a KendoUI grid. Above the grid is a textbox which allows custom searches using comma-separated values. In all other pages which use the grid without the custom search textbox, the built-in "AND" and "OR" filters work great.
When using this page, "OR" is always treated as "AND".
Here's an example of the form data being posted via ajax using "OR" for a column in the grid called "ToolDefinitionName". I am also filtering on FacilityId = 39. When this filter is run, it returns no data even though both ToolDefinitionNames are valid:
take:50
skip:0
page:1
pageSize:50
sort[0][field]:EntityCode
sort[0][dir]:asc
filter[logic]:and
filter[filters][0][field]:FacilityId
filter[filters][0][operator]:eq
filter[filters][0][value]:39
filter[filters][1][logic]:or
filter[filters][1][filters][0][field]:ToolDefinitionName
filter[filters][1][filters][0][operator]:eq
filter[filters][1][filters][0][value]:PIZio
filter[filters][1][filters][1][field]:ToolDefinitionName
filter[filters][1][filters][1][operator]:eq
filter[filters][1][filters][1][value]:KIJos
Here is the code for the custom filtering:
var kendoGrid = $("#grid").data("kendoGrid");
var searchText = $("#tool-search").val();
var searchParts = searchText.split(",");
var search = { logic: "and", filters: [] };
search.filters.push({ field: "FacilityId", operator: "eq", value: _selectedFacilityId });
if (searchParts.length > 0)
search.filters.push({ field: "EntityCode", operator: "contains", value: $.trim(searchParts[0]) });
if (searchParts.length > 1)
search.filters.push({ field: "ProcessName", operator: "contains", value: $.trim(searchParts[1]) });
if (searchParts.length > 0)
kendoGrid.dataSource.filter(search);
kendoGrid.dataSource.pageSize(_selectedPageSize);
kendoGrid.dataSource.read();
Any help would be greatly appreciated.
I have a page with a KendoUI grid. Above the grid is a textbox which allows custom searches using comma-separated values. In all other pages which use the grid without the custom search textbox, the built-in "AND" and "OR" filters work great.
When using this page, "OR" is always treated as "AND".
Here's an example of the form data being posted via ajax using "OR" for a column in the grid called "ToolDefinitionName". I am also filtering on FacilityId = 39. When this filter is run, it returns no data even though both ToolDefinitionNames are valid:
take:50
skip:0
page:1
pageSize:50
sort[0][field]:EntityCode
sort[0][dir]:asc
filter[logic]:and
filter[filters][0][field]:FacilityId
filter[filters][0][operator]:eq
filter[filters][0][value]:39
filter[filters][1][logic]:or
filter[filters][1][filters][0][field]:ToolDefinitionName
filter[filters][1][filters][0][operator]:eq
filter[filters][1][filters][0][value]:PIZio
filter[filters][1][filters][1][field]:ToolDefinitionName
filter[filters][1][filters][1][operator]:eq
filter[filters][1][filters][1][value]:KIJos
Here is the code for the custom filtering:
var kendoGrid = $("#grid").data("kendoGrid");
var searchText = $("#tool-search").val();
var searchParts = searchText.split(",");
var search = { logic: "and", filters: [] };
search.filters.push({ field: "FacilityId", operator: "eq", value: _selectedFacilityId });
if (searchParts.length > 0)
search.filters.push({ field: "EntityCode", operator: "contains", value: $.trim(searchParts[0]) });
if (searchParts.length > 1)
search.filters.push({ field: "ProcessName", operator: "contains", value: $.trim(searchParts[1]) });
if (searchParts.length > 0)
kendoGrid.dataSource.filter(search);
kendoGrid.dataSource.pageSize(_selectedPageSize);
kendoGrid.dataSource.read();
Any help would be greatly appreciated.