How do I clear all the filter boxes on a grid at once?

1 Answer 189 Views
Grid
Fredric
Top achievements
Rank 1
Fredric asked on 30 Aug 2021, 08:55 PM

I have a simple grid and just want a button to clear all search filters. I can clear the actual filters, but the values in the textbox persist (screenshot below). How can I clear those textboxes?


1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 31 Aug 2021, 06:48 PM

Hi Fredric,

In order to clear the values from the Kendo UI Grid filter row, use the following custom function and use the click method:

public clearFilter() {
  var clearButton = document.querySelectorAll<HTMLElement>('.k-clear-button-visible');
  for (let i = 0; i < clearButton.length; i++) {
    setTimeout(() => clearButton[i].click());
  }
}

In this StackBlitz example, along with clearing the filter, I could also clear the filter textboxes in the Kendo UI Grid.

I hope this helps. Please let me know if I can further assist you.

Regards,
Hetali
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Fredric
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or