jsTreeR
jsTreeR copied to clipboard
Cannot select node with child
I want to be able to select just one node that may or may not have children and only return that node.
Two issues:
- With "multiple" set to FALSE, multiple children will be returned when selecting a node.
- When I want to select a node but not its children, all of the children are selected and returned rather than the node.
Is there a way to determine the actual node that was selected when the selected node has children?
Hello,
Please next time use StackOverflow for questions like this.
I'm not sure to understand your question. you want to select a parent node without selecting its children?
Basically I want to select a directory from a file tree. If it has children, then there is no guaranteed way to select only the directory due to how the selection propagates.
Ok. Indeed, the selection always "cascades" to the children nodes. But you can attach some data to the nodes, e.g. type="folder"
and type="file"
, and then filter the selection. But yes, the children will be selected, visually speaking.
Right, but I want to be able to select a "folder" that contains another "folder." Is there a way to change how the selection "cascades"?
No, but that's not a problem. Each folder will have the "attribute" type="folder"
, and you filter all nodes which have this attribute.