liquor-tree
liquor-tree copied to clipboard
Uncheck all children when a specific node is unchecked
Hey there! I love this library. I'm struggling with what seems to be a limitation of the library API:
Is there a way to get all children of a given node? I want to call .children().uncheck()
or something similar but there seems to be no such feature
By default I need to disable the autoCheckChildren
functionality, so i set autoCheckChildren: false,
in options.
Then I want to uncheck all children ONLY when a specific node is unchecked like this:
node 1
|- node 2
|- node 3
|- node 4
node 4
when node 1 becomes unchecked I would like to force all children to become unchecked. Is there a way to do this?
Hi! Yeah.
const node1 = this.$refs.tree.find('node 1')
node1.recurseDown(node => {
if (node.checked) {
node.uncheck()
}
})
Thanks! I can't see that anywhere in the documentation, I guess I need to look through the source code to find it?
Yes. I don't have time to fill the documentation... :( Or you can aks here :)