Replies: 2 comments
-
@gthiet Absolutely! The You can also assign "object paths" to your nodes which are then bubbled up with // create a "path" property with its path from root
// this path can be used by something like https://github.com/mariocasciaro/object-path to retrieve the node later
const assignObjectPaths = (obj, stack) => {
Object.keys(obj).forEach(k => {
const node = obj[k]
if (typeof node === 'object') {
node.path = stack ? `${stack}.${k}` : k
assignObjectPaths(node, node.path)
}
})
}
// somewhere before render
assignObjectPaths(data)
// render
<DropdownTreeSelect data={data} onChange={onChange} /> |
Beta Was this translation helpful? Give feedback.
0 replies
-
I ended up using the _id and depth properties to recursively grab the label property, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given a leaf node, Is there a way to find it's full path to the root node?
Beta Was this translation helpful? Give feedback.
All reactions