Is it possible to store these selected filters in a variable and have it updated as well when the use selects another set of filters? If so, how?
Codesandbox: https://codesandbox.io/s/muidatatables-custom-toolbar-forked-lrbf16
Is it possible to store these selected filters in a variable and have it updated as well when the use selects another set of filters? If so, how?
Codesandbox: https://codesandbox.io/s/muidatatables-custom-toolbar-forked-lrbf16
Copyright © 2021 Jogjafile Inc.
To achieve that, you can use
onFilterChange
callback, like this :This function will be called everytime filter list changes.
Then, you declare function
extractFilters
which will extract all selected filters from passedfilterList
and it will return array object containting all selected filters :You can store this array in state.
Here is working example.