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");

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 )


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);



}



}



}

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 )

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.

As fast solution, you can try to add attached patch to existing js files, it will override part of code which cause slowness

fast_pointer.zip (1.56 KB)


Thank you for the fast solution. However, I tried to include this js in the same directory and added







on top of JSP. It did not seem to change anything. The scripts still timeout after 30 seconds.

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.

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?

IE 7.0.5730.11. This time I tested with check 200 nodes in 3000 nodes tree, and IE timeout after 30 seconds

Actually, testing checking 50 nodes still times out after 30 seconds.

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.


Hi,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>



<o:p> </o:p>



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.<o:p></o:p>


sample.html.zip (798 Bytes)

Answer sent by email.