Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Narayana Swamy on Nov 05, 2009 23:03
open dhtmlx forum
Dynamic loading of tree data while expanding node using servlets.

I have a tree with multiple levels, each will have thousands of nodes. I am trying to load entire tree at a single shot. But its taking lot of time to load. So what i need is i need to load the child nodes when i am exapanding parent node.

I heard we can do by using
tree.setXMLAutoLoading(url);
tree.loadXML("root.xml");

But i don't have static xml file. I have to get the data from the database. I have some questions regarding above 2 lines of code.

1. Is root.xml will contain all the nodes information or only the parent node information.
2. When we are calling setXMLAutoLoading(url) - will this return only the child nodes of a expanding parent node or all the nodes information.
3. How it will understood i am expanding so and so node.

Thanks in advance.....
Answer posted by Alex (support) on Nov 06, 2009 02:33

Hello,

>> But i don't have static xml file. I have to get the data from the database. 

you can generate xml stream on server - the data from the database will be used to create this stream.

>> tree.loadXML("root.xml");  Is root.xml will contain all the nodes information or only the parent node information.

instead of root.xml  there can be path to the server-side script that generates the tree structure that will be loaded initially

>> . When we are calling setXMLAutoLoading(url) - will this return only the child nodes of a expanding parent node or all the nodes information.

>> How it will understood i am expanding so and so node.

Please, see the article about dynamic loading and sample:

http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxtree:increasing_tree_s_performance

http://www.dhtmlx.com/docs/products/dhtmlxTree/samples/12_loading_processing_data/13_tree_dyn_loading.html