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

Clearing filters programmatically

1 Answer 692 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 02 Aug 2019, 06:18 PM

When I try to do the following, the UI Filters are not reset, but the appropriate data is displayed.

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

I have tried this also: 
grid.dataSource.filter();

 

Although not ideal, this works and the UI filters are reset:

$(".k-i-filter-clear").click();

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 06 Aug 2019, 11:43 AM
Hello Peter,

The grid.dataSource.filter({}) affects not only the dataSource, but also clears the filter menu forms. For your convenience, I am attaching a simple demo that demonstrates the described approach. Please examine it and let me know if you have any further questions.

You can also test the above approach by following:
  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. 
$("#grid").data("kendoGrid").dataSource.filter({})
As a result the Grid will rebind and all filtering inputs will be cleared.

Hope this helps and pelase contact us in case of any questions.

Regards,
Nikolay
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or