There is such a structure:

--1 -a -b --2 -c -d -e -f 

How to make it so that when you select (select) the node of the 1st tree to remove the selection from the nodes of the 2nd tree?

    2 answers 2

    It is necessary to add an onSelect handler in the initialization of the plugin for the element:

     $("#tree").dynatree({ […] onSelect: function(flag, node) { // это пример из документации, но по аналогии вы можете сделать свои условия if( ! flag ) alert("You deselected node with title " + node.data.title); var selectedNodes = node.tree.getSelectedNodes(); var selectedKeys = $.map(selectedNodes, function(node){ return node.data.key; }); alert("Selected keys: " + selectedKeys.join(", ")); }, […] }); 
    • Roman, thanks for the reply. Handler I certainly added. This example looked. It does not work when for example ^^ node "e" deselect all nodes of 1 tree from all nodes. - haswell
    • Can you make a working example of your code on JSFiddle? - Zhukov Roman

    Everything worked out. In the onSelect handler, I used node.getKeyPath () to find the key of the upper parent. And check when choosing a node, the parent has changed or not, if so, remove the selection.