How to Traverse selectedNodes in 'onChange' handler to Reach Child Values #470
Replies: 1 comment
-
@andrewhazel thanks for starting a discussion and not an issue! Also, thanks for the great description. The Since most react apps have some kind of app/page state store like context or redux or mobx, the component allows for you to keep track of grandchildren/children/parent selection via |
Beta Was this translation helpful? Give feedback.
-
Hey all,
I stumbled across this component to incorporate into a project I am currently working on - the tree-like structure ultimately makes the most sense for the respective design in the project.
I am attempting to pass data containing regions (i.e. Asia, Africa, etc) and then have children within those regions (i.e. Southern Asia, Western Asia, etc.) and finally countries that belong to those regions. I have noticed that 'selectedNodes' only displays the values for whichever depth nodes you are on. This should not be a problem, however when I go to access the children of those nodes I get 'undefined'.
I noticed that there is a reference to the children (i.e. the pointer to the children nodes), so I'm unsure if there is something I am missing to be able to reference the child node and its respective value (potentially my linked-lists knowledge has failed me).
Ultimately, it would be great to select a region like 'Asia' and end up with the values for the grandchildren.
Beta Was this translation helpful? Give feedback.
All reactions