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.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)