Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prakash on Aug 22, 2008 08:45
open dhtmlx forum
Deleting Node Elements in DHTMLX Tree

Hi,

I am using DHTMLX Tree professional Edition1.6. I am having a problem in deletion of node elements. I am getting a script error like this


SCRIPT ERROR: 'this.allTree.childNodes.0' is null or not an object


Below is how i am constructing a tree


TREE CONSTRUCTION:

            aMenu2=new dhtmlXContextMenuObject('120',0,"<%=request.getContextPath()%>/images/treespec/imgs/");
            aMenu2.menu.loadXML("<%=request.getContextPath()%>/xmlfiles/_context.xml");                
            aMenu2.setContextMenuHandler(onButtonClick2);    
            aMenu2.setOnShowMenuHandler(focusSelectedItem2)
            
            var tree2=new dhtmlXTreeObject("usertree","100%","100%",2);
            tree2.setImagePath("<%=request.getContextPath()%>/images/treespec/csh_bluefolders/");
            tree2.enableDragAndDrop(true);
            tree2.enableMercyDrag(true);
            tree2.enableContextMenu(aMenu2);
            tree2.attachEvent("onDrag",DraggingTreeItems);
            tree2.attachEvent("onDrop",ChangeItemId);
            tree2.attachEvent("onClick",onNodeSelect2);
            tree2.enableSmartRendering(true);
            tree2.loadXMLString(mycontracts);
            tree2.enableKeyboardNavigation(true);
            tree2.setDragHandler(checkDraggableItem);
            tree2.closeAllItems("2");




The tree is constructed with 10000 records. My tree element deletion function is as follows


DELETION FUNCTION:tree2.deleteItem(destinationid1,true);

In the above function a variable 'destinationid1' holds the value of the selected item in tree2 to be deleted.



Can you please suggest me solution for this problem.


Awaiting for your reply,


Thanks,




With regards,
PRAKASH.N




Answer posted by Support on Aug 25, 2008 03:06
The mentioned error may occur only in case, when super-root item was deleted from tree. 
The super root item ID defined by 4th parameter of constructor, and has "0" as ID by default, please be sure that you have not used same ID for some other elements in tree and not called delete operation against it. 

There were some fixes in SRND extension for dhtmlxtree ( none of them directly related to mentioned issue ) - so, if problem still occurs for you - please contact us directly at support@dhtmlx.com - we will send you latest codebase.