Categories | Question details Back To List | ||
refreshItems not adding nodes I am using the dhtmlXTree. I have a requirement to load most of the tree, perhaps 3/4. There is a top level node, let's call it A that will have at most two descendant levels. A ->B ->->C Level A as well as all level B's will be loaded. When clicking on level B, the child nodes of level B will be loaded dynmically from the server. I am able to get the correct data back, but refreshItems doesn't seem to be putting them anywhere. There are no errors given, either. Here is how I load my tree initially. <pre> function loadTree(gci) { tree=new dhtmlXTreeObject("treebox_tree","100%","100%",0); tree.setImagePath("<%=request.getContextPath()%>/images/dhtmlx/"); tree.enableDragAndDrop(1); tree.attachEvent("onDrag",leftTreeOnDrag); tree.attachEvent("onClick",refreshTheClickedNode); tree.loadXML("xmlData?action=getData"); } </pre> Here is how I am trying to refresh the nodes. <pre> function refreshTheClickedNode(nodeId) { var array = new Array(); array[0] = nodeId; alert('subitems before:' + tree.getAllSubItems(nodeId)); tree.refreshItems(array,"xmlData?action=refresh"); alert('subitems after: ' + tree.getAllSubItems(nodeId)); } </pre> The id of the clicked link is: "001344746" The data returned looks like this: <pre> <tree id="001344746"> <item text="Ford Motor Company 9001344746 A CUS" id="Uri://www.bankofamerica.com/xmlschema/party/p2pid/123564" im0="iconStar.gif" im1="iconStar.gif" im2="iconStar.gif" imheight="16px" imwidth="16px" style="color:black; background-color:#FFFFB0;"/> <item text="Ford Motor Company 8001344746 A CUS" id="Uri://www.bankofamerica.com/xmlschema/party/p2pid/123564" im0="iconStar.gif" im1="iconStar.gif" im2="iconStar.gif" imheight="16px" imwidth="16px" style="color:black; background-color:#FFFFB0;"/> <item text="Ford Motor Company 7001344746 A CUS" id="Uri://www.bankofamerica.com/xmlschema/party/p2pid/123564" im0="iconStar.gif" im1="iconStar.gif" im2="iconStar.gif" imheight="16px" imwidth="16px" style="color:black; background-color:#FFFFB0;"/> </tree> </pre> I get no errors, but neither does the refreshed node show any children. Making a call to getAllSubItems, to check if anything was added, does not return anything neither before, nor after the call. Thanks for your help. Answer posted by Support on Feb 15, 2008 05:47 Tree supports two items a) tree.refreshItem this method refetch child branch of item, supports only one node per call b) tree.refreshItems this method supports many nodes per call , but updates only nodes specified as parameters, no new child will be added Just update in you code var array = new Array(); array[0] = nodeId; alert('subitems before:' + tree.getAllSubItems(nodeId)); tree.refreshItems(array,"xmlData?action=refresh"); with tree.refreshItem(nodeId,"xmlData?action=refresh"); |