gregnb / gregnb/mui-datatables
How do I set initial active filters?
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
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 |
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the table options handling and the filter-menu state used when the table initializes. Trace how user-added filters are represented, then determine the smallest supported way to declare initial active filters and verify that the requested Author Name filter is visible and applied on first render.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100