Angular 2 ag-grid's Clear Filter button clears the textbox without refreshing column when built-in filter is used
Angular 2 ag-grid's Clear Filter button clears the textbox without refreshing column when built-in filter is used
When ag-grid's default filter is enabled, the clear filter button only clears the text box and doesn't refresh the column even though 'clearButton' and 'applyButton' params are set to true. After clicking the Clear filter button the text gets cleared from the textbox and I have to actually click Apply Filter button to remove the filter and refresh the column.
Below is my code:
result.filter = "date";
result.filterParams =
applyButton: true,
clearButton: true
;
Is there a way where we can make Clear Filter button actually refresh the column along with clearing text box? Or is there any event available for clear button click which we can subscribe to? (in documentation there isn't any event mentioned for clear button click)
Help will be appreciated
1 Answer
1
A listener can be attached to click event of some specific filter's clear button and inside listener we can call this.gridOptions.api.onFilterChanged()
to trigger the change.
this.gridOptions.api.onFilterChanged()
let filterInstance = this.gridOptions.api.getFilterInstance("name_col");
filterInstance.eClearButton.addEventListener("click", () =>
this.gridOptions.api.onFilterChanged();
);
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.