mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

How do I set initial active filters?

Open Lori-Becker opened this issue 3 years ago • 2 comments

Maybe I'm not seeing it in the documentation, but I'd like to define a filter by default on my datatable. Similar to the sortOrder property in the table options object, I thought there might be something where I could set a default filter when the table is initialized, ie: column 'Author Name' where value = "Stephen King". Does MUI-datatables have this ability?

Expected Behavior

When defining table options, there is a property to set a specific set of active filters.

Current Behavior

Currently, filters can only be added by users interacting with the table's filter menu.

Your Environment

Tech Version
Material-UI 5.2.2
MUI-datatables 4.0.0
React 17.0.2
browser Chrome

Lori-Becker avatar Sep 09 '22 16:09 Lori-Becker

Same question here!!

codyng avatar Jun 30 '23 15:06 codyng

I found the answer. Just set the filterList from the column option, e.g. filterList: [ 'cat' ] I have searched for some questions with this same question but I couldn't find any answers. Why hasn't anyone addressed this question? :)

codyng avatar Jun 30 '23 22:06 codyng