Categories | Question details Back To List | ||
No nested items on dynamic loading and animation for dynamic loading. Hi. We are testing dhtmlxTree for commercial porpouses. It may sound like a bunch of newb questions but: - We retrieve data from the server using the dynamic XML method, and everything works great... But for some reason, we can't find how to prevent the tree of a zero results query and avoid the "XML refers to not existing parent" error. Do we need to specify it on the XML format? Any Javascript function? - Is there any change to setup the tree to display a classic animated gif, or change the icon while the request its been processed? Thanks in advance. Answer posted by Support on Apr 11, 2008 02:19 >>Do we need to specify it on the XML format?
Tree expect to receive data in some specific format, so the correct empty response will be <tree id="0"></tree> It will not render any items, and will not throw any error. Basically you can block error messages as well http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=918&ssr=yes&s=catchError >>- Is there any change to setup the tree to display a classic animated gif Tree allows to attach any custom code on start and end of XML loading, so you can implement any kind of "loading..." message. http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=948&ssr=yes&s=onXLS http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=2137&ssr=yes&s=onXLS Answer posted by Luis on Apr 11, 2008 19:45 Thanks for the answer! The empty response thing its solved now. In the other hand, about to change the folder icon when fetching data from the server, today we tried this method based on the knowledge base and your comments: setItemImage2(selectedIdNode, 'closedFolder.gif', 'fecthing.gif', 'openFolder.gif' ) This one, using the onOpenStart event handler. It worked great when fetching data from the server. But for some reason, we just can't put back the closedFolder gif. To do so, we tried the onXLE event. Here I must say that we can't retrieve the node id, using the nameOfTheTree.getSelectedItemId() method. We tried storing the node id in a global variable, and using Firebug we see the node id stored in the global variable, so we can use setItemImage2(selectedIdNode, 'closedFolder.gif', 'closedFolder.gif', 'openFolder.gif' ) and put the gif back. We don't have errors about this, but when we manually close the node, the fetching gif is still there... Any workaroud about this one? Again, thanks for your time. Answer posted by Support on Apr 14, 2008 02:03 In described scenario onOpenStart occurs for any item opening|closing operation, while onXLE occurs only when data from server loaded If you want to change icon on loading each time when item opened, and changing it back when data loaded from server you can try to use next code grid.attachEvent("onOpenStart",function(id,state){ if (state!=1) setItemImage2(id, 'closedFolder.gif', 'fecthing.gif', 'openFolder.gif' ) return true; }) grid.attachEvent("onOpenEnd",function(id,state){ if (state==1) setItemImage2(id, 'closedFolder.gif', 'closedFolder.gif', 'openFolder.gif' ) return true; }) Answer posted by Luis on Apr 15, 2008 07:38 Thanks! It worked great. |