Enabling autocomplete filtering using multiple fields instead of just "getOptionLabel" field
See original GitHub issueCurrently using Autocomplete component of material UI, by default I can only filter options basing on “getOptionLabel” field. however, with “createFilterOptions” I can add another additional field like following.
const filterOptions = createFilterOptions({ matchFrom: 'start', stringify: option => option.title, });
I am wondering if I could be able to do something like below(should be able to filter with all the fields in the object)
const filterOptions = createFilterOptions({ matchFrom: 'start', stringify: option => option, });
Examples 🌈
here I am using match-sorter to include multiple fields(title and year) for filtering as per docs. can I achieve this without “match-sorter”? https://codesandbox.io/s/material-demo-urobl?file=/demo.js:618-632
Motivation 🔦
so that I don’t have to use another library to achieve this functionality.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:8 (8 by maintainers)
Top GitHub Comments
@NMinhNguyen Ok, thanks for the explaination
@NMinhNguyen I think that we can delay the topic for some time, to better gauge the pain.
createFilterOptions
was meant to be a quick and dirty solution until developers implement something, on their side, that fully matches their use cases.