Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Pravu Mishra on Jul 17, 2009 05:34
open dhtmlx forum
fetching child tree node names while clicking on a parent node

Hi,

My tree(dhtmlxTree) need to have four layer of childs and the number of nodes in each layer is more than 50. I need to display the first layer while loading page and fetch child nodes of first layer while user clicks on any of the nodes in first layer and later layers.

Can any body suggest how to implement this with a sample.

Thanks and Regards,

Pravu Mishra.

 

 

Answer posted by Alex (support) on Jul 20, 2009 00:55

hello, 

you can use dynamic loading functionality. Please, see details in the article http://dhtmlx.com/docs/products/dhtmlxTree/doc/dyn_loading.html

the sample is http://dhtmlx.com/docs/products/dhtmlxTree/samples/loading_processing_data/tree_dyn_loading.html (dhtmlxTree/samples/loading_processing_data/tree_dyn_loading.html in the tree package)

Answer posted by Pravu Mishra on Jul 20, 2009 04:13

Hi Alex,

found the following code for dinamic tree from the URLs provided by you.

           tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
           
tree.setImagePath("../imgs/");
           
//link tree to asp script
           
tree.setXMLAutoLoading("xml.php");
           
           
//load first level of tree
           
tree.loadXML("xml.php?id=0");

I used the following ways to get the value of id for the clicked node

1) var selectedId=dhxTree.getSelectedItemId();
2) var selectedText=
dhxTree.getSelectedItemText();

But all did not help to get get the id value of the clicked node.

Could you please let me know how to get the value of the id for passing while using the loadXML method(the above bold string).

Thanks and Regards,

Pravu Mishra.

 


 

Answer posted by Alex (support) on Jul 20, 2009 04:36

Hello, 

in case of dynamic loading the id of the loaded node is passed automatically. Please, see the article that was mentioned in the previous answer.

But getSelectedItemId() returns id correctly. When did you call this method ?