Open jlubeck opened 4 years ago
It's difficult to be sure what exactly may be happening, as there's a lot of code, but my guess is that serverside is what's tripping you up. Serverside functionality right now is all or nothing, so it's opting you into serverside filters which work differently from client side filters in a couple of ways. Have a look at the serverside-filters
example for some ideas.
You can also test if this is the main culprit by testing your filters with serverside set to false
.
I think I see what's going on here - the table creates an internal array-of-arrays object called filterList from the individual filterList arrays on each column. This "master" filterList is used as the state for the filter dialog. In your example you're saving this master filterList to your state, but you're not correctly setting the individual filterLists for each column. Instead you're setting the master filterList on one column.
Have a closer look at the the server-side filters example (https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-filters/index.js) and how the filterList props for each column are set.
Also, I just tried out the server-side example and this issue will present itself there too but for a different reason. The server-side example returns the same bit of data regardless of what filters you choose, so if, for example, you filter on the location "Baltimore" you'll get this issue but only because the return data doesn't have "Baltimore" in it and "Baltimore" isn't one of the choices in the dropdown list.
So this will still be a problem in the above example if you don't get any results back. One way around this is to set the filterOptions (ex: https://github.com/gregnb/mui-datatables/blob/master/examples/customize-filter/index.js).
Hey @patorjk thanks a bunch for troubleshooting my issue. As soon as I get a minute I'm going to double check with your comments and circle back here. Unfortunately this is for a side project of mine, so it might take me a while... But thank you so much!
My filter has a few bugs which I'm not sure if they are bad configurations or bugs.
First let me show you what is happening:
Current Behavior
There are couple of different things
1) After clicking on a filter it doesn't stay on the box. The box gets a blank space. Although I do see a pill. 2) After clicking the reset buttons, nothing happens 3) After clicking the X on the pill, the filter is not removed and a white screen is shown. 4) It would be nice to close the filter window after choosing a filter automatically. Is that possible?
Steps to Reproduce (for bugs)
Here is my view:
Your Environment