I have data displayed in ag grid. It has 4 columns name,age,sport and has the following data:-
data
now when I filter the data based on "sport" , lets say uncheck "blanks" I get the following data:- filtered data
1)My questions is how to get the which filter is applied on columns , like in this case "blanks" is applied on "sport".
2)If I refresh the data using api.setRowdata(), filter applied to the columns are lost
1.how to get the which filter is applied on columns
You can get it using gridApi.filterManager.allFilters
Check this live example ag-grid: Built-In Filters - log the filters applied.
Apply age
and year
filters and then click Log Filter
button.
age: {column: Column, filterPromise: Promise, scope: null, compiledElement: null, guiPromise: {…}}
year: {column: Column, filterPromise: Promise, scope: null, compiledElement: null, guiPromise: {…}}
__proto__: Object
Starting from [email protected]
to get or set all applied filters you can take advantage of using:
const savedModel = gridApi.getFilterModel();
gridApi.setFilterModel(savedModel);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With