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

Null filter issue while trying to clear Multiselect grid header filter

1 Answer 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ankit
Top achievements
Rank 1
Ankit asked on 23 Jun 2018, 08:57 AM

Hi 

I dont know , what i am doing wrong while trying to clear all multiselect header filters, as after clearing all columns, somehow a null filter get set on a random header column. Below is my code

01.function clearFilter(filter,grid) {
02.       if (filter.filters) {
03.           for (var i = 0; i < filter.filters.length; i++) {
04.               clearFilter(filter.filters[i],grid);
05.           }
06.       }
07.       else {
08.           grid.dataSource.filter({
09.               field: filter.field,
10.               operator: filter.operator,
11.               value: ""
12.           });
13.       }
14.   }


1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 26 Jun 2018, 10:31 AM
Hello,

In general the passing and empty object to the filter method of the Kendo UI DataSource should be enough for your case in order to clear the grid filter. 

1) Go to http://demos.telerik.com/kendo-ui/grid/filter-row
2) Apply some filters to the Grid
3) Execute the following in the browser's JavaScript console. The Grid will rebind and all filtering inputs will be cleared.

$("#grid").data("kendoGrid").dataSource.filter({})


Regards,
Boyan Dimitrov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Ankit
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or