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

Search function in multiple select box loops through values instead of labels. #8202

Closed
remyvanderwereld opened this issue Nov 15, 2017 · 3 comments

Comments

@remyvanderwereld
Copy link

What problem does this feature solve?

I'm using a select input with a user_id as value and the username as label. When using the automatic search in multiselect modus, it's searching for an id/value instead of the username/label.

What does the proposed API look like?

It would be nice to give a parameter to the select input like:
searchFor={label}

@gavinrobertszeco
Copy link

As per the instructions, new issues should be created using http://new-issue.ant.design

optionFilterProp and filterOption allow you to manage how to filter the available options, i.e.

<Select
    showSearch
    optionFilterProp="children"
    filterOption={(input: any, option: any) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
   >
   ...
</Select>

The above will filter case insensitively filter the available options by label.

This is shown on the documentation https://ant.design/components/select/#components-select-demo-search

HTH

@remyvanderwereld
Copy link
Author

Thanks Gavin!

@gavinrobertszeco
Copy link

Not a problem @remyvanderwereld

FYI, use the new-issue tool, as issues tend to get canned otherwise.

@afc163 afc163 closed this as completed Nov 15, 2017
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