Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter #6

Open
srconklin opened this issue Jan 17, 2016 · 1 comment
Open

filter #6

srconklin opened this issue Jan 17, 2016 · 1 comment

Comments

@srconklin
Copy link

Hi
Is there a way to make the filter only math the characters at the beginning of the option text values?

@insin
Copy link
Owner

insin commented May 31, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants