Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by scott on Feb 05, 2009 05:51
open dhtmlx forum
Closing all subnodes in a tree when a node is closed

Hi

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.

thanks

Scott
Answer posted by Support on Feb 05, 2009 08:16
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 
 tree.closeItem(some_id);
you can use
 tree.closeAllItems(some_id)

( if you want to automate such behavior, you can assign code to onOpenEnd event , and case closeAllItems when branch in tree closed )
Answer posted by scott on Feb 05, 2009 08:42
can the attachEvent("onOpenEnd", functionName) be added to a tree defined in html and not javascript?


Answer posted by Support on Feb 06, 2009 06:01
Can be set through attribute as 

<div class="dhtmlxTree"  setOnOpenEndHandler="some_function_name"