I am using dynatree
to select multi-nodes in a hierarchy of directories.
So, I have investigated the behavior of all built-in options for selectMode
, but, unfortunately, none of them resolves my problem:
- 1: single-selection (not my case)
- 2: multi-selection
- it does not select the parent node when all children nodes are selected (ok)
- it does not select all children nodes when the parent node is selected (not ok)
- 3: hierarchical multi-selection
- it selects the parent node when all children nodes are selected (not ok)
- it selects all children nodes when the parent node is selected (ok)
The behavior for my case would be correct if:
- it does not select the parent node when all children nodes are selected
- selecting all children directories is different from selecting the parent of them
- it selects all children nodes when the parent node is selected
- otherwise, the user might not understand that the children are also selected
Question #1: How to implement this behavior?
Furthermore, the dtnode.tree.getSelectedNodes()
is returning redundant nodes:
/Foo
/Foo/Bar
If /Foo
is selected, it is already implied that /Foo/Bar
is selected, for me.
Question #2: How to optimize the selected nodes redundancy?