I am genrating the tree from following code
function loadTree()
{
var project_id=document.getElementById(“p_id”).value;
var sys_id=document.getElementById(“s_id”).value;
tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);
tree.setImagePath(“dhtmlxTree/samples/images/”);
tree.setIconSize(18,18);
//tree.enableCheckBoxes(false, false);
tree.enableTreeLines(false);
tree.enableMultiLineItems(true);
tree.enableAutoTooltips(true);
tree.preventIECaching(true);
tree.enableIEImageFix(true);
tree.enableSmartXMLParsing(true);
tree.setOnClickHandler(function(id){openPathDocs(id);});
tree.setXMLAutoLoading(“XML/fmea_tree.jsp?project_id=”+project_id+"&sys_id="+sys_id);
tree.loadXML(“XML/fmea_tree.jsp?project_id=”+project_id+"&sys_id="+sys_id,autoselectNode);
}
when i add the node to the tree I trying to refersh the tree with following method
function addNode()
{
var parId=parent.tree.getSelectedItemId();
parent.tree.refreshItem(parId,“XML/fmea_tree.jsp?project_id=<%=project_id%>&sys_id=<%=sys_id%>”);
}
but when it refersh the same tree appeared at the end.
I would like the add the new node and reresh the tree and show the new inserted node in same tree status.
tree.refreshItem will
- delete all existing childs of item
- load new XML from server
- fill tree with data from new XML
basically , it will not preserve any item added on client side but not existing in returned XML for updated branch
Pro version of dhtmlxtree supports
tree.smartRefreshItem
which works in a bit more complex manner, instead of deleting existing content it updates item values based on incoming XML, but still - it will delete any item which not present in XML returned from server.
I am using professional DHTMX version, and using the same method parent.tree.smartRefreshItem(parId); which you suggested but still not getting right output. Sometime its showing the error Same id’s are in the XML tree’s after adding the node and disturbing the sequence of the tree.
I am very much sure about the node id�s , these are unique for each node. Please help me for the same.