Closing all subnodes in a tree when a node is closed


When i close a node in a tree i have noticed that the subnodes remain open which is causing a problem when i drag and drop. Is there a way to close all subnodes and their children when i close a node?

i basically want to use the closeAllItems method when a user closes a node on level 2 of the tree.



closeAllItems can be used with ID as parameter , in such case it will close all items starting from provided one ( items on top levels will stay not closed )

so , instead of
you can use

( if you want to automate such behavior, you can assign code to onOpenEnd event , and case closeAllItems when branch in tree closed )

can the attachEvent(“onOpenEnd”, functionName) be added to a tree defined in html and not javascript?

Can be set through attribute as

<div class=“dhtmlxTree” setOnOpenEndHandler=“some_function_name”