When executing insertNewIten. If current node is closed, two same child nodes will be added. Then resume adding, it will not be shown under parent node, but background program has performed.
Main Page Codes:
tree.loadXML(“treeInit.nhn?domain_id=” + domainId);
tree.setXMLAutoLoadingBehaviour(“function”);
tree.setXMLAutoLoading(function(id) {
var type = tree.getUserData(id, “type”);
tree.loadXML(“treeChild.nhn?id=” + id + “&type=” + type + “&domain_id=” + domainId);
});
Pop-up Page Codes:
if (window.opener.tree) {
var pid = “${(rtnMap.pid)!’’}”;
var id = “${(rtnMap.id)!’’}”;
var text = “${(rtnMap.text)!’’}”;
var type = “${(rtnMap.type)!’’}”;
var tree = window.opener.tree;
tree.insertNewItem(pid, id, text, 0, “folderClosed.gif”, “folderOpen.gif”, “folderClosed.gif”, “CHILD”);
tree.setUserData(id, “type”, “E”);
}
Hello,
When the insertNewItem method is called, the parent branch opens. If the branch wasn’t opened before (it wasn’t loading), autoloading function will be called. So, if this function adds the same nodes as insertNewItem method, such a issue can take place.
Thank you Alex.
I also don’t know how to solve this issue rightly. I try like this
var state = tree.getOpenState(pid);
if (state == “0”) {
tree.openItem(pid);
}
But there is no effect for it. Can you help me describing it detailedly?
Thanks anyway.
Please, provide the sample where the problem can be recreated or direct link to the problematic page. You can send this information to support@dhtmlx.com.
If you provide a sample, please provide a static xml instead of php script:
1) xml for for root;
2) xml that is loaded after insertNewItem called.