Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by avoorhis on Jul 02, 2009 11:29
open dhtmlx forum
openItemsDynamic and onOpenDynamicEnd

Hi,
I am trying to restore a tree from a list of checked nodes that was saved as returned from the function: tree.getAllChecked()
I use dynamic loading and here is the code I'm using:
%%%%%%%%%%%%

event_id = tree.attachEvent("onOpenDynamicEnd",function(){
                                    
    for(i=0;i<node_array.length;i++)
    {
         tree.setCheck(node_array[i],true)                                        
    }                                        
                                        
tree.focusItem(node_array[0])
                                        
    tree.detachEvent(event_id)                                                

})
                                    
tree.openItemsDynamic(parent_node_string)

%%%%%%%%%%%%%%%%%%%%
The parent node(s) containing the checked nodes get opened, but the nodes do not get checked. I should say that the nodes do get checked if the parent node was previously opened (manually), but not initially.

Any insight you could provide would be helpful.
We're using this version:
dhtmlxTree v.1.6 Professional edition build 71114

-andy
Answer posted by Alex (support) on Jul 06, 2009 00:48

Hello,

the parameter of the method openItemsDynamic is list of items that should be opened - from top-level node to target. For example if you want to open not-loaded item that is placed on the 3rd level, you should use  openItemsDynamic as follows:

tree.openItemsDynamic("toplevel_parent_id,2level_parent_id,3level_item_id");

So, parent_node_string should contains all necessary items and called after root level is loaded:

tree.loadXML(path_to_script,function(){

tree.openItemsDynamic(parent_node_string);

})