Categories | Question details Back To List | ||||||||||||||
dhtmlxtree with enableSmartXMLParsing setCheck is slow We have a dhtmlxtree with about 3000 nodes, checkbox enabled. If we have enableSmartXMLParsing(true), after the page is loaded, the script tries to call setCheck() for about 80 nodes. This always timeouts on IE. If we disable the SmartXMLParsing, it takes long time to load the tree, but, no problem calling 80 times of setCheck() after the tree is loaded. Is this a known issue? Is there a suggested work around? Thanks, tree=new dhtmlXTreeObject(document.getElementById('dxmlTreeDiv'),"100%","100%",0) tree.setImagePath("img/dxmlTree/"); tree.enableCheckBoxes(true); tree.enableDragAndDrop(false); tree.enableSmartXMLParsing(true); tree.attachEvent("onCheck",onNodeCheck); tree.loadXML("/rae/psglTreeXMLAction.do?method=loadXML&id=0"); Answer posted by Support on Feb 19, 2009 02:13 3000 nodes is not so much to cause performance problems. In local test , tree process setCheck for 1000 items ( in closed branch ) in 140ms ( IE, faster in other browsers ) >>tree.attachEvent("onCheck",onNodeCheck); Which code executed from onNodeCheck event? Can it be the reason of slowness? If issue still occurs for you - please provide a sample of used XML data ( you can send it directly to support@dhtmlx.com ) Answer posted by Vincent Wang on Feb 19, 2009 07:06 tree.attachEvent("onCheck",onNodeCheck); checks to see if it's uncheck, then uncheck some other nodes. (Code below). However, the checking of 80 nodes happens when the tab was clicked, not on checkbox onCheck event. I used alert box to find the slow part is during: for (i=0; i<arr.length; i++) { tree.setCheck(arr[i], 1); } I will send the XML data to the email. Thank you for supporting. function onNodeCheck(nodeId, state) { if (state == 0) { var ids = tree.getAllChecked(); var arr = ids.split(","); var raeId = tree.getUserData(nodeId, "RAEId"); for (i=0; i<arr.length; i++) { if (arr[i] != "") if (raeId == tree.getUserData(arr[i], "RAEId")) { tree.setCheck(arr[i], state); } } } Answer posted by Support on Feb 19, 2009 07:59 We was able to locate the reason of problem ( thanks for provided sample ) and seems it can be solved It will take some time to provide final solution - we will send an updated version of dhtmlxtree.js in few days. ( the same fix will be included in next version of dhtmlxtree as well ) Answer posted by Vincent Wang on Feb 19, 2009 08:02 Thank you very much for quick response. As we are having release next week, please send the updated js file as soon as it's ready. Much appriciated. Answer posted by Support on Feb 19, 2009 10:23 As fast solution, you can try to add attached patch to existing js files, it will override part of code which cause slowness Attachments (1)
Answer posted by Vincent Wang on Feb 20, 2009 09:24 Thank you for the fast solution. However, I tried to include this js in the same directory and added <script LANGUAGE="JavaScript" src="/rae/scripts/dhtmlxTreePro/fast_pointer.js"></script> on top of JSP. It did not seem to change anything. The scripts still timeout after 30 seconds. Answer posted by Vincent Wang on Feb 20, 2009 15:00 With the fast_pointer.js, it seems to make it worse. Now to check 16 nodes for the 3000 node tree times out the browser. Answer posted by Support on Feb 23, 2009 08:04 Strange, in local sample for IE7 it works up to 6 times faster than default logic. ( sample sent by email ) Which version of IE you are using for tests? Answer posted by Vincent Wang on Feb 23, 2009 08:14 IE 7.0.5730.11. This time I tested with check 200 nodes in 3000 nodes tree, and IE timeout after 30 seconds Answer posted by Vincent Wang on Feb 23, 2009 08:17 Actually, testing checking 50 nodes still times out after 30 seconds. Answer posted by Vincent Wang on Feb 23, 2009 08:28 A little more information. With 50 nodes to check, the first time after the tree is loaded (tree not expanded with tree.enableSmartXMLParsing(true)), it takes about over 1 minutes to check all 50 nodes. However, after they ar checked, if I clear them and check them again, it finishes every fast. So, the slowness only happen the first time after the tree is loaded. Answer posted by Vincent Wang on Feb 26, 2009 05:56 Hi, Again, thank you very much for the support. With the updated js files, IE does not throw timeout message no more, but still takes about 15 to 30 seconds. The new problem is that the tree.getAllChecked() is now timing out with that 80 checked nodes. I updated the sample.html with 80 nodes and submit button to call tree.getAllChecked(). After loading and checking the tree, if you click on the button, you will see the call takes very long time. Attachments (1)
Answer posted by Support on Feb 27, 2009 04:16 Answer sent by email. |