Categories | Question details Back To List | ||
dhtmlx tree - messages while processing Hi folks, is there a possibility to display a user message while processing the tree? For example if you open/close large trees it looks like nothing is happening while the tree is rendered. Is there a chance to display a message while rendering? Reason is that the user might click the tree node serveral times while the tree is processed - this leads to an confusing open/closing behavior of the tree... Thank for your support. I'm testing the pro version at the moment (30days trial) - so it can be a "pro solution" Answer posted by Alex (support) on Jul 21, 2009 07:56 hello, you can use onXLS (loading start) and onXLE (loading end) events: tree.attachEvent("onXLS",function(){ /*some code that shows loading message*/ }) tree.attachEvent("onXLE",function(){ /*some code that hides loading message*/ }) Or you can try to use automatic loading message (dhtmlxtree_lf.js extention): tree.enableLoadingItem(text); Answer posted by M. Wolf on Jul 21, 2009 21:52 Thanks for your quick answer. I already found out about the onXLS and onXLE functions - this is perfect for a message while loading the tree. But the tree.enableLoadingItem(text); does not work anyway. When the whole tree is loaded - at beginning - there is no node to display the message. So there is no information. When the tree is fully loaded the onClick event to expand the whole tree does not work anymore. There is no reaktion. The main problem is, that the whole tree is loaded form the server via xml an ís displayed colsed by default. The user can click the first root node to expand the whole tree - or he can click the +-icon just to expand the subsection of the node. Clicking on tree item always expands the whole subtree. Thats the desiered behavior of the tree - an it works fine. The only problem is, the expanding the whole tree - or a large subtree - takes some time. The user clicks the root-item an it seams nothing is happening - so he might click again... and again... And then the tree is opend and closed again ... an reopend... So what I'm looking for is a method to display a message while the tree is opend or closed using the tree.closeAllItems(itemId) or the tree.openAllItems(itemId) function to prefent user from clicking serveral times while tree is processed. As allready said - the whole tree is loaded as a single xml file at pageload - so ist not about a message while the tree is loaded. So here is the code: mtree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); mtree.setImagePath("<?=base_url()?>assets/js/dhtmlxSuite/dhtmlxTree/codebase/imgs/"); mtree.loadXML("<?base_url()?>get_xml_tree",function(){ mtree.loadOpenStates("_mtree"); }); mtree.enableSmartXMLParsing(true); mtree.attachEvent("onXLS",function(){ document.getElementById('loadmsg').style.display='block'; }); mtree.attachEvent("onXLE",function(){ document.getElementById('loadmsg').style.display='none'; }); mtree.attachEvent("onClick", function(){ var itemId = mtree.getSelectedItemId(); if('NODE' == mtree.getUserData(itemId, 'knoten_typ')){ window.setTimeout(function(){ mtree.saveOpenStates("_mtree"); },1); if(1 == mtree.getOpenState(itemId)){ mtree.closeAllItems(itemId); }else{ mtree.openAllItems(itemId); } } }); Thanks for your support - the suite is a real great piece of work MW Answer posted by Alex (support) on Jul 22, 2009 05:50 There is lockTree method that can help in this case (dhtmlxtree_li.js should be included): tree.attachEvent("onXLS",function(){ Answer posted by R Blanchard on Aug 21, 2009 07:32 I have got the 2.1 version of DHTMLX TreeGrid Enterprise and I cannot find this dhtmlxtree_li.js; I'm would like to use the lockTree function. Answer posted by Alex (support) on Aug 21, 2009 07:57 dhtmlxtree_li.js is tree extension. In case of treegrid you can use another approach: grid.setEditable(false); /*to disable editing*/ grid.attachEvent("onOpenStart",function(){return false}) /*to disable opening*/ |