gregnb / gregnb/mui-datatables
Filter on displayed data (clientside)
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Is it possible with the table options to only have filter show values that are in the current data set (after 1. filter)?
*This is probably not a bug, but by design, so more of a question task*
## Expected Behavior
The original data set is 100 items with e.g 10 different values for "Unit". Then I filter on e.g column "X" and value "Y". The table data then filters on this value and leaves 20 items in the table. Then I filter on e.g. "Unit" and the filter dropdown shows all 10 units, but I want it to only show the 4 units that's in the current table data. Not the 10 units that were in the original data set.
## Current Behavior
The original data set is 100 items with e.g 10 different values for "Unit". Then I filter on e.g column "X" and value "Y". The table data then filters on this value and leaves 20 items in the table. Then I filter on e.g. "Unit" and the filter dropdown shows all 10 units.
## Your Environment
filterType: 'dropdown',
serverSide: false
| Tech | Version |
|--------------|---------|
| Material-UI | 4.7.0 |
| MUI-datatables | 2.13.1 |
| React | 16.8.6 |
| browser | Chrome |
| etc | |
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the client-side case described: apply one filter, then inspect the values offered by a second column's dropdown. Trace where dropdown options are derived from the table data and determine how the current filtered set is represented. Done means a second dropdown offers only values present in the currently filtered rows, while preserving the existing behavior for the original dataset.
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