filter
srconklin opened this issue · comments
Scott Conklin commented
Hi
Is there a way to make the filter only math the characters at the beginning of the option text values?
Jonny Buchanan commented
Not currently, but we could add a prop which takes a test
function which would receive the current filter and the item being tested:
The current implementation is effectively this:
function contains(filter, optionText) {
return optionText.toUpperCase().indexOf(filter.toUpperCase()) !== -1
}
What you're asking for would be:
function startsWith(filter, optionText) {
return optionText.toUpperCase().indexOf(filter.toUpperCase()) === 0
}
We could also export a basic selection of test functions so people don't have to write their own.