gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 934 forks source link

Filter on displayed data (clientside) #1143

Open eaidland opened 4 years ago

eaidland commented 4 years ago

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
gabrielliwerant commented 4 years ago

This isn't possible with any of the basic options, but you can build filters that work this way yourself using the filterOptions.

GitMurf commented 3 years ago

Did anyone come up with a good solution for this? I am very interested in this functionality as well. Thanks!