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

Expand/Collapse all nodes #98

Closed
Alannek1992 opened this issue Oct 9, 2019 · 1 comment
Closed

Expand/Collapse all nodes #98

Alannek1992 opened this issue Oct 9, 2019 · 1 comment
Labels
question Further information is requested

Comments

@Alannek1992
Copy link

Hello,

I ve found out, that you provide a reset functionality to operate on openNodes. I am just curious about the data structure of the openNodes. Basically its a "itemA/itemB" etc. Do I have to write my own algorithm, which transform my data, which are being passed to TreeMenu into this form "key/key" etc. I am just wondering if there is a more smooth way to do that :).

BR,
Ales.

@iannbing
Copy link
Owner

Yes, and it's intentional.

If the default expand/close behaviour meets your requirement, you only need to provide data. But if you have specific requirements, then you have to implement your own logic, this TreeMenu component allows you to manipulate almost everything.

openNodes is used when you want to have full control over every node, and you don't want the default expand/close behaviour AT ALL. You can see the storybook example here. I guess this API is rarely used.

If you only want to set the tree to a specific shape but still allow users to use the tree menu, you can use initialOpenNodes, see example here. This API is more useful I guess.

@iannbing iannbing added the question Further information is requested label Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants