gregnb / gregnb/mui-datatables

Make filter data inputs be more similar to that of a form field

Open
#797 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

Hi, I've tried looking through the open issues for filters but couldn't find anything related.

Would it not make sense for filters to accept an array of objects in the form of {value, label} where label are only used for display purposes and value would be used everywhere else (e.g. the list of filters returned in onFilterChange would have the selected values, rather than labels)

I am aware it is possible to make this work by using custom filters, but I thought it makes more sense to make the datatables work this way. Because of the way HTML form components are expected to work with label and value pairs.

There are 2 fairly quick solutions:
- add a new prop to `filterOptions` that would expect the required filter list shape: [{value: "value", label: "label"}]
- repurpose `names` to work with either a list of strings or a list of objects.

Please let me know your thoughts on this. I'm happy to spend some time working on it

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.