Categories | Question details Back To List | ||
dhtml-tree getting error ---> too much recursion in mozilla, Stack overFlow in IE7 Trying to add child element by function aFunc(). It is adding child element infinite times ************************************************************************ function aFunc(id) { tree.insertNewChild("wwww","wwww/aaa","aaa",0,0,0,0,'SELECT'); } ************************************************************************ tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); tree.setImagePath("images/csh_yellowbooks/"); tree.enableTreeImages("false"); tree.enableTreeLines("false"); tree.setOnClickHandler(tonclick); tree.setOnOpenHandler(aFunc); tree.loadXML("http://www.aaa.com/userACxml/"+username+".xml"); *************************************************************************** Kindly let me know how can I add child elements to parent node or element Answer posted by Support on Oct 13, 2008 04:53 In your code, each time when new item opened , you are creating new item with the same ID, which will result in non unique IDs and may case infinite recursion, same as in your case. Please be sure that value , which used as ID of new item is unique per each item. Answer posted by Nirmala on Oct 13, 2008 05:11 No, I am giving unique ID only. Parent ID -- wwww Child ID -- wwww/aaa in mozilla it is pointing to these error lines.. based on this can you assist me this.userData=new cObject(); from function dhtmlXTreeItemObject(itemId,itemText,parentObject,treeObject,actionHandler,mode){}Hope this helps to resolve my problem. Previously was getting whole data from XML file.. but that was taking time to load my tree.. now I want to implement same thing by Ajax. mean I will get Fist level data from XML file, second level data want to add by tree.insertNewChild(); so that my tree grow dynamically. Answer posted by Support on Oct 13, 2008 07:10 In your code snippet both parent and child IDs are hardcoded, so when such code will be executed for second time - it will cause non unique ID for child item. The correct code may look as function aFunc(id) { var nid = (new Date()).valueOf(); tree.insertNewChild(id,nid,"aaa",0,0,0,0,'SELECT'); } >>second level data want to add by tree.insertNewChild(); so that my tree grow dynamically. You can use dyn. loading, when branches loaded from server side separatly, on-demand. http://dhtmlx.com/docs/products/dhtmlxTree/samples/loading_processing_data/tree_dyn_loading.html?un=1223908220000 |