GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Right now the search feature only uses 'contains' logic, meaning the results will include all items that have the specified text anywhere in the text. It would be nice if we could change the functionality to only include items that start with the specified text.
For example, if I type in 'es' I would see 'United States' among the results. It would be nice if I could changed it so I would only see 'Estonia'
At the moment, search only shows "starts with" and "es" should not match United States. I don't think searches based on contain are particularly useful. If someone is searching for "es" they probably mean to match Estonia and not United States, Bangladesh, United Arab Emirates, etc.
I guess I should have tested my example...a better example is 'St' matching 'United States'. It would be nice if we could choose whether we select items where any word starts with the specified text or the first word starts with it.
What about the described option?
Currently I need a 'contains' logic. Why you don't want to add the option?
I want this as well.
I have a drop down with:
Member Id : Name
1234 : Alistair
5678 : Bob
It is important for them to be able to view and search on the ID, but in most cases they will be searching against the name.
Another vote to re-open this issue from me.
I'd really like to specify "contains" searching, for example
@AlistairB and @philBrown Both of the search cases you describe should work in Chosen today as the search regex matches from the start of each word.
Two things have been asked for in this thread that Chosen does not do:
This feature is actually very useful for none english users, for example, in Chinese, normally, we do need to change the input method for input Chinese characters, normally, we might include some latin chars in the utf-8 strings, so that user can type the latin chars directly to make a quick search, instead of switch the input method before the next step. I think providing an extra option will be very useful. Thanks.
I got excited about Chosen because I really liked the simple UI, but it lacked the ability to select anything unless you knew the exact start of a word. This may work for simple/known entries like states or countries, but not when using an unfamiliar list containing street names, mixed category/products, client/project or pre-entered phone number values.
I started using the "Searchable DropDown" plugin and it offers quite a bit of customization that I wish was available in Chosen (however it's limited to a single selected item):
There are options for:
Another plugin I use is AutoSuggest. It's UI is similar, but it searches subtext, highlights the search text and adds the ability to create new values on-the-fly. It can also perform an ajax request to retrieve json list from web server. (This is critical when it's impractical to include a large list of possible values inline.)
Hi, @pfiller , this feature is very useful for Asian Languages, e.g. Chinese. So why not support it? :)
Sorry. I found this feature is already supported in v0.9.8.
Just use like this:
I am unable to search with starting letters of a word. Please help