Hi,
I have a scenario where an API I'm using is only able to filter by one column at a time. So either name, or email, or phone number, stuff like that.
How can I prevent multiple filters being set at the same time?
I tried binding a mousedown handler to the filter button in the filter menu and iterating over the existing filters to set them to an empty string. Something like this, which I found here on the forums:
1.
$(
".k-filter-menu"
).find(
"button[type='submit']"
).on(
"mousedown"
,
function
() {
2.
var
dataSource = $(
"#myGrid"
).data(
"kendoGrid"
).dataSource;
3.
for
(
var
i = 0; i < dataSource.options.fields.length - 1; i++) {
4.
dataSource.filter({ field: dataSource.options.fields[i].field, value:
""
});
5.
}
6.
dataSource.filter([]);
7.
});
This triggered several ajax calls though with filters like "Name~undefined~''".
Is there a better way to handle this scenario?
Kind regards,
Georg