Hello Telerik Folks,
We are trying to do custom filtering on the Client leveraging the Kendo Grid dataSource.Filter() functionality in JavaScript. We have created a header above our grid that allows a user to select many filter criteria and then we apply them for the user all at once in a JavaScript function. This approach has many benefits for us in that it allows us to create a cleaner more intuitive interface up top that shows all of the Users' filtering selections together. It also allows us to leverage Kendo Grid's paging without having to write our own paging and filtering Server side.
The local ApplyFilter() function that pieces together the JSON needed to create the combined multi-column filter into a newTotalFilter string. We then apply this filter at the end with this logic.
// *** Apply Filter to Grid
if
(newTotalFilter.length>0) {
gridData.dataSource.filter({
logic:
"and"
,
filters: newTotalFilter
});
}
else
{
var
gridData = $(
"#OurGridID"
).data(
"kendoGrid"
);
gridData.dataSource.filter({});
}
This works great, but we are running into problems when constructing filters that appear to push the limits of what this type of Filtering can do. Fox example for some columns we provide a checkbox list to allow users to select the items they want to appear below. This is comparable to a SQL 'IN' statement. As the Kendo Grid doesn't have an 'IN' filtering functionality we try to piece together several 'Contains' with an 'Or' for that particular column.
So for example, there might be a checkbox list with
- ItemA
- ItemB
- ItemC
- ItemD
- ItemE
The user might select or Check Items A,B & C. We would then build out the JSON to look like this...
[
{
"filters"
: [
{
"field"
:
"ItemsColumn"
,
"operator"
:
"contains"
,
"value"
:
"ItemA"
},
{
"field"
:
"ItemsColumn"
,
"operator"
:
"contains"
,
"value"
:
"ItemB"
},
{
"field"
:
"ItemsColumn"
,
"operator"
:
"contains"
,
"value"
:
"ItemC"
}
],
"logic"
:
"or"
}
]
But when we apply the above JSON we only get the first two rules applied to the ItemsColumn. We can see the limitation if we go into the UI for the column filter. It only shows the first two being applied. (Please see attached image.)
So what we are wondering is, is there a way to increase or get around this apparent 2 rule limit to the number of filter rules that may be applied to a single column? ...We would like to construct and apply filters in JSON and not be limited to two rules per column.