Tree Methods not Executing After Initialization

Hi,

I am having a very strange problem with the method calls for the trees not executing properly. For example, after initializing the tree, I call a function, merely for testing purposes, to see if I get returned the expected values; this tree is one of the examples provided in the download package.

			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
			tree.setSkin('dhx_skyblue');
			tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
			tree.enableCheckBoxes(1);
			tree.loadXML("../common/tree3.xml");
			document.write(tree.getAllItemsWithKids() + 'test');

Although the tree displayed shows that many nodes have kids, this returns nothing but my ‘test’ string. I noticed this problem after I could no longer preset some of the nodes to a checked state and I tested these other methods to see if I could get anything useful as to why it was not working.

It’s interesting to note that although it does not work immediately after the tree has been created, when I call the functions with onClicks, they do work.

Thank you for any information that could resolve this issue.

Hi,

methods that operate items should be called from “loading end” handler:

tree.loadXML("…/common/tree3.xml",doAfterLoading);

function doAfterLoading(){
document.write(tree.getAllItemsWithKids() + ‘test’);
}

Thank you very much – the issue has been resolved with your help.