Hi
I have the following, and this works… However when i change index in the combo box the next xml is appended to the end of the existing tree.
How would I tell this to replace the existing tree with the new one.
Thanks
Simon
Hello,
in order to reload tree you can use the following method:
tree.deleteChildItems(0);
tree.loadXML(“js/”+selected_value);
Try to use it instead of
tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);
tree.setImagePath(“js/imgs/csh_bluebooks/”);
tree.loadXML(“js/”+selected_value);
Hi I just tried this
however this removes all child items and leaves the root.
The initial function is good but on change of selected index i would like to dispose the previous and load the new xml in its place?
Thanks
Simon
Hi I just tried this
however this removes all child items and leaves the root.
The initial function is good but on change of selected index i would like to dispose the previous and load the new xml in its place?
Thanks
Simon
In this case you can use just (without removing previous items):
tree.loadXML(“js/”+selected_value);
Hi Alex thanks for the help
I am not sure I understand "
In this case you can use just (without removing previous items):
tree.loadXML(“js/”+selected_value);"
Is this not what I already have? I am very new at this, I load the tree all good. But when I change selected index I wish the tree to be rebuilt with the new items and not add to the existing tree as if called for the 1st time.
Simon
Ok…
tree.loadXML(“js/”+selected_value); loads items from the xml. This method will add new items to the existent structure.
If you want to rebuild tree, you can call tree.deleteChildItems(0); before loadXML to delete previous structure.
If you want to initialize tree again, you can call desctructor() and then tree initialization code:
tree.destructor();
tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);
tree.setImagePath(“js/imgs/csh_bluebooks/”);
tree.loadXML(“js/”+selected_value);
Aha Superb, thanks that now works great.
Thank you for the effort in helping a newb.
Simon