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

Transfer component's filterOption prop doesn't work unless something is entered in the search box #39906

Closed
ivan-tkatchev opened this issue Dec 29, 2022 · 2 comments · Fixed by #39916

Comments

@ivan-tkatchev
Copy link

ivan-tkatchev commented Dec 29, 2022

Reproduction link

https://codesandbox.io/s/antd-reproduction-template-forked-p0hnr1

Steps to reproduce

When a Transfer component has a filterOption prop that doesn't depend on search filter state, it will not be triggered unless a non-empty string is entered into the search filter input.

What is expected?

filterOption should work regardless of whether something is entered into the search input.

What is actually happening?

User is forced to type something into the search input for filtering to occur.

Environment Info
antd 5.1.1
React 17.0.1
System Linux
Browser Mozilla
@afc163
Copy link
Member

afc163 commented Dec 30, 2022

Like Select/AutoComplete, Transfer filterOption prop works in searching situation. If you need to filter items in initial situation, please filter dataSource before passed to Transfer.

#39916

@ivan-tkatchev
Copy link
Author

ivan-tkatchev commented Dec 30, 2022

I need to filter the left (available items) pane only. If I filter the dataSource before passing to Transfer this affects the items in the right (selected items) pane too.

The use case is when additional widgets are doing searching/filtering of the available items list. (E.g. a select input with preset filtering options.)

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

Successfully merging a pull request may close this issue.

2 participants