Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Simon on Nov 09, 2007 04:04
open dhtmlx forum
dhtmltree - Problem with openNode method combined with enableDistributedParsing

Hello,

I have a problem with the enableDistributedParsing method when I need to open or select a node after loading :
the dhtmltree only loads a part of the tree. It works fine without any node opening.

My tree code is the following :
<script type="text/javascript">
tree=new dhtmlXTreeObject('treeBox',"100%","100%",0);
                        tree.setOnClickHandler(doOnClick);
                        tree.setImagePath("./imgs/");
                        tree.enableDistributedParsing(true);
                        tree.loadXML("tree.xml", openNode());
    </script>    

I'm using openNode because the openItem() function isn't launched when called in the previous script portion :
function openNode () {
        tree.openItem(200);
}
Any ideas? maybe i should call the openItem () in the script portion directly, after the tree.loadXML instruction? it doesn't work for me...
thanks
Regards
Simon
Answer posted on Nov 09, 2007 05:42
The second parameter of loadXML is a function , so it must be something similar to next
    tree.loadXML("tree.xml", openNode);
or
    tree.loadXML("tree.xml", function(){
        tree.openItem(200);
    });


In case of distributed parsing the onXME event and second params differs

tree.attachEvent("onXLE",function(){
    // this will be called after ALL items from xml parsed
});

tree.loadXML("tree.xml", function(){
    // this code will be called when xml loaded and first chunk of XML parsed
});