react-dropdown-tree-select icon indicating copy to clipboard operation
react-dropdown-tree-select copied to clipboard

control the search field

Open KB-AWARE opened this issue 3 years ago • 6 comments

Hi,

I want to know if it is possible to control the search field or have a onInputChange callback?

Thanks.

KB-AWARE avatar Jul 15 '22 10:07 KB-AWARE

So I handled this by passing a custom searchPredicate that saves the search term in a ref. It's wasteful because that predicate runs on every node, but it at least works.

The part that I do not believe there is an API for is controlling the search field. I previously requested a way to provide an initial input for the search field, and a built-in way to view the current search term, and was told that would be an enhancement.

gandhis1 avatar Jul 15 '22 18:07 gandhis1

Hi,

Thanks for you reply. Finally I used the same trick as you but it is not ideal as the search term return nothing if there is no more items in the filtered options.

The other thing is that it is mandatory that you put options to have a a non null searchTerm. It is annoying as I wanted to fetch the options async.

KB-AWARE avatar Jul 19 '22 07:07 KB-AWARE

Yeah, I have also noticed this doesn't work if clearSearchOnChange is selected.

gandhis1 avatar Jul 26 '22 20:07 gandhis1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 25 '22 22:08 github-actions[bot]

I have a PR for this, keep open

gandhis1 avatar Aug 25 '22 22:08 gandhis1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 25 '22 22:09 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 08 '22 22:11 github-actions[bot]