iannbing / react-simple-tree-menu

A simple React tree menu component
MIT License
137 stars 48 forks source link

Is there an event that fires when a node is expanded? #175

Open deniszik opened 3 years ago

deniszik commented 3 years ago

Greetings!

Is there an event that fires when a node is expanded? And is there an example of processing it, how to get the ID of the node that was opened but not selected?

Thank you!

iannbing commented 3 years ago

There's no out-of-box solution. You need to create your own list item component, see the example in this story here. In line 54, you can call your function.

And for getting the open/selected node id from your menu, currently there's no API for it.

deniszik commented 3 years ago

I'm sorry, it's not that strong in Javascript - in fact, I need to implement lazy loading (node loading) when opening a tree node. To do this, as I understand it, I need to get the node id and call the function to load new data. Then just insert that data into the tree array at the right place.

Can you clarify - do I need to add my function via && next to ToggleNode () or replace the whole line?

sisqology commented 3 years ago

Good day

Same issue I have. Is there a way to parse the item clicked into clickNode in TreeMenu?