I am using react-table v7 (https://www.npmjs.com/package/react-table) . I am able to filter the data (referred from https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/filtering ) and I am using SelectColumnFilter function for all the columns to filter . I would like to create a button which will reset all the filters. Like If I have applied filters to 4 columns by clicking on the RESET ALL button I want all the filters to be cleared. Can someone please help me with this ? Thank you
You can get the setAllFilters method from useTable instance, and then
const { ...setAllFilters } = useTable({ columns, data }, userFilters)
// somewhere at you code
<button onClick={() => setAllFilters([])}>Reset</button>
checkout setAllFilters at https://github.com/tannerlinsley/react-table/blob/master/docs/api/useFilters.md
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