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 datasource array from smallest string to biggest #18

Closed
lfarah opened this issue Aug 5, 2016 · 3 comments
Closed

Filter datasource array from smallest string to biggest #18

lfarah opened this issue Aug 5, 2016 · 3 comments

Comments

@lfarah
Copy link
Contributor

lfarah commented Aug 5, 2016

By doing that, we are always autocompleting the smallest possible option, avoiding errors in compound city names, for example.

My case

User wants to type "Salvador" (city in Brazil)

My DataSource array:

["são Paulo", "salvador do Sul", "macapa", "salvador"]

Problem:

Salvador do sul is autocompleted instead of Salvador because it goes first in the array, and since Salvador has less characters, it will never autocomplete.

Solution

always filter datasource from the smallest string to the biggest, so every single string will have the chance to be autocompleted

@nfhipona
Copy link
Owner

nfhipona commented Aug 6, 2016

added fix

@nfhipona nfhipona closed this as completed Aug 6, 2016
@lfarah
Copy link
Contributor Author

lfarah commented Aug 6, 2016

Thanks!

@carlbrusell
Copy link

thanks

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

No branches or pull requests

3 participants