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

Sort flattened search result alphabetically #302

Open
bill-zhongjie-li opened this issue Oct 24, 2019 · 8 comments
Open

Sort flattened search result alphabetically #302

bill-zhongjie-li opened this issue Oct 24, 2019 · 8 comments
Labels

Comments

@bill-zhongjie-li
Copy link

In the case of searching the dropdown tree list, by default the search result is flattened. Can we sort the search result alphabetically, or provide an option to sort them alphabetically?

@bill-zhongjie-li bill-zhongjie-li changed the title Sort flatten search result alphabetically Sort flattened search result alphabetically Oct 24, 2019
@mrchief
Copy link
Collaborator

mrchief commented Oct 25, 2019

It preserves the tree order. Sorting them alphabetically could be done but the UX could become confusing. Doing it via option adds some complexity especially when you consider keepTreeOnSearch. I don't see an easy way out but would be open to looking at a PR if it doesn't add much complexity.

The next version should make it easier though as you'd be able to bring in your own renderer where you could effectively sort the tree before rendering.

@hamzhi
Copy link

hamzhi commented Nov 5, 2019

Hi there, @bill-zhongjie-li you can sort data and children before put it into component, it's not dificult. But I have another problem. @mrchief when I trying to search word 'test' and parent and child includes this word, then child move in the end.
https://codesandbox.io/s/react-dropdown-tree-select-ordi4

image
image

@mrchief
Copy link
Collaborator

mrchief commented Nov 5, 2019

That shouldn't happen. Do you have a codesandbox that reproduces this?

@hamzhi
Copy link

hamzhi commented Nov 5, 2019

Of course, see my post above, or I'll just duplicate the link here https://codesandbox.io/s/react-dropdown-tree-select-ordi4

@mrchief
Copy link
Collaborator

mrchief commented Nov 6, 2019

Oh, sorry for missing that. Thanks! I'll take a look.

@stale
Copy link

stale bot commented Nov 21, 2019

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

@stale stale bot added the stale label Nov 21, 2019
@mrchief mrchief added bug and removed stale labels Nov 21, 2019
@github-actions
Copy link

github-actions bot commented Dec 1, 2021

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 github-actions bot added the stale label Dec 1, 2021
@mrchief mrchief removed the stale label Dec 2, 2021
@ramijaschek
Copy link

I encounter a similar issue with search on the tree changing the order:

image

vs.

image

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

No branches or pull requests

4 participants