cemang
February 27, 2016, 5:28pm
#1
Hello,
myTree = new dhtmlXTreeObject(“treeboxbox_tree0”,“100%”,“100%”,0);
myTree.setImagePath(“…/…/…/codebase/imgs/dhxtree_skyblue/”);
myTree.load(“…/common/tree.xml”);
myTree.attachEvent(“onOpenStart”, function(id,state) {
myTree.deleteChildItems(0); //call this method getting error ‘TypeError: c.htmlNode is null’ in firebug
myTree.load(“…/common/tree.xml”);
return true;
})
using FF.
Cemang
Hello,
The code you posted is rather weird. The error is caused by deleteChildItems call from the onOpenStart. Could you describe your idea ?
cemang
February 29, 2016, 9:13am
#3
Alexandra thank you for your replay.
The point is :
When the openstart firing, i want mytree to refresh and load, may be by calling deletechilditems is the wrong way, could you show me the other way?
Thanks
Cemang
When the openstart firing, i want mytree to refresh and load
You can choose onOpenEnd instead. And probably you will need to restore open state (saveOpenStates and loadOpenStates - pro edition):
ignore = false;
tree.attachEvent(“onOpenEnd”, function(id,state) {
if(!ignore){
tree.saveOpenStates();
tree.deleteChildItems(0);
ignore = true;
tree.loadXML("…/common/tree.xml", function(){
tree.loadOpenStates();
ignore = false;
});
}
return true;
});
cemang
March 4, 2016, 7:47pm
#5
Thank’s Alexandra,
one more question, how to sort the childs of a node tree that is just added a child using insertNewChild. I tried calling sortTree but the new item added as a child is always created as the last one of child items for the specified parent.
Best regards,
Cemang.
Hello,
Did you call sortTree after insertNewChild ? There is also insertNewChild that allows to insert an item after another item.
cemang
March 14, 2016, 9:31am
#7
Yes, i called sortTree after insertNewChild
Yes, i called sortTree after insertNewChild
Locally tree is correctly sorted. Could you provide a snippet that reproduces the problem ?