Hi,
Is it possible to programmatically set a column's filter whose "multi" flag is set to true on grid load?
The code I have here:
1.
$(
"#Grid"
).data(
"kendoGrid"
).dataSource.filter({
2.
field:
"Person"
,
3.
operator:
"eq"
,
4.
value:
"Brian"
5.
});
... doesn't seem to filter properly or show the checkbox for the selected filter. It filters out everything and no checkboxes in the filter menu are selected.
Thanks!
7 Answers, 1 is accepted
I made an example using the provided approach to set a filter programmatically and the filter was applied as expected on my end to the "ProductName" column:
http://dojo.telerik.com/oruXO
In case I missed an important part of the scenario, please modify the Dojo and I will gladly assist further.
Regards,
Stefan
Progress Telerik
Hi Stefan,
This works -- however, I'm using the MVC controls with the associated HtmlHelpers. Does your scenario work with the MVC grid as well?
Thanks!
The same approach can be used in the MVC Grid.
I made an example and the result is the same.
I attached the example for reference.
Regards,
Stefan
Progress Telerik
Hi Stefan,
That was perfect. I see what I did wrong now. I used the column header name instead of the field name to filter on.
Problem solved. Thanks so much!
This does not works if set the dataSource.filter with multiple filters like this.
$("#grid").data("kendoGrid").dataSource.filter(
{
"filters": [{
"field": "ShipCity",
"operator": "ne",
"value": "ShipCity 2"
},
{
"field": "ShipName",
"operator": "ne",
"value": "ShipName 2"
}],
"logic": "and"
}
);
Is there a different way of setting multiple filters?
I have investigated the provided code snippets and it appears that they are set-up as expected. However, the project that has been provided by my colleague in the post below uses an outdated version of the Kendo UI suite. Can you try using the same approach with the latest version and see if the issue is still present?
For your convenience, I am attaching the modified project to my response. Give it a try and let me know how it works out for you.
Kind regards,
Tsvetomir
Progress Telerik
All good.
Thanks