alekseymakhankov / hyper-tree

React treeview component
MIT License
68 stars 11 forks source link

Expand Nodes on Dynamic Selection #16

Open chezdesign opened 2 years ago

chezdesign commented 2 years ago

Hello, So i have a structure like this:

{ "id":2022, "value":2022, "children":{ "id":"June", "value":"June", "children":{ "id":"02", "value":"02", "children":{ "id":"08:00", "value":"08:00" } } } }

I am dynamically selecting the last node with the id: '08:00' with this method: handlers.setSelected(lastNodeId, true); The checkbox becomes checked but the nodes are still uncollapsed.

My question is: how can i select for example the id: '08:00' and in the same time I want all the nodes to be expanded up to that value?

For example if the id: '08:00' is selected, I want the '2022' and 'June' and '02' nodes to be expanded automatically.

Thanks!

alekseymakhankov commented 2 years ago

@chezdesign Hi! Try handlers.setOpen(lastNodeId)