react-datatable
react-datatable copied to clipboard
Table Column Filters
It should be possible to automatically filter to show only particular rows with a particular column values.
How would this work with a paginating API? I guess you would need to pass the filtering features to the API through some standard semantics? What would the UI look like?
@bebraw what I'm thinking there will be an index of unique names and respective index e.g.
{
country : {
'US' : [5,11,13],
'AU' : [1,3,6]
}
}
Clicking the country column should drop down these values and from there the paginator would loop depending passing in a filtered index to real index e.g. if US is selected 0 -> record[5], 1 -> record[11], 2->record[15] . If there are more than one selected, then I will do a union/set of the actual index per filtered property. That's the plan and I don't know if there is a more efficient way on doing it.
Btw, appreciate all the inputs/feedback you have on other issues/features.
Doesn't this mean you would have to maintain ids for all items related to a specific country? This could get problematic with a large amount of records.
This is why I believe it would be more beneficial to provide something like a callback based API that allows you to hook into the filtering logic and do whatever you want (ie. query new items from backend, etc.).
That said if there's a limited amount of data, your approach can work as well. But even then you can benefit from a callback based API and implement your idea on top of it. In that case you would just filter the data React operates with instead of hitting the backend.