dowjones/react-dropdown-tree-select

How to get children values on selectedNodes on onChange method when parent is selected?

VSV6 opened this issue · 7 comments

VSV6 commented

When the parent node is selected, I need the children values also on the onChange method.

How can I achieve this?

You'd have to tease that out by keeping track of the data nodes yourself. One way would be to assign a node-path it each node and using that property, you can get to node.children in your data bag.

VSV6 commented

OK but node.children is undefined in my case.

Yeah, node.children in your data bag :)

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.

node.children is undefined in my case. How we can solve it?

node.children is undefined in my case. How we can solve it?

You're looking at the node argument - you should be looking at the corresponding node in your own separate state/data bag. It requires you to keep tracking data on your own but it can be abstracted into an HoC https://codesandbox.io/s/l765q6lmrq?file=/HOC.js

There are plenty of examples in old issues if you search for them.

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.