material-table-core / core

Datatable for React based on material-ui's table with additional features. Support us at https://opencollective.com/material-table-core
https://material-table-core.github.io
MIT License
295 stars 146 forks source link

Dynamically change filter value for a column #862

Open rOY369 opened 1 month ago

rOY369 commented 1 month ago

Hi, I have a use case where I want a click event to dynamically change the filter value for a column in my table component.

defaultFilter works fine If I pass it in my initial columns definition.

But then I dynamically change the defaultFilter prop of a specific column in useEffect -> it doesn't work.

Changing the prop like filtering to false from true works just fine in the same useEffect and removes the filtering dynamically. This indicates that the there is no problem with useEffect itself.

How can I dynamically change the filter value of a column based on an outside event or change of some other state? Am I using the correct prop for the column or is there any other prop for this use case?

Any help would be appreciated regarding this. Thanks in advance.

Domino987 commented 4 weeks ago

Would you be able to add a sandbox with your code and what you tried?