No nested items on dynamic loading and animation for dynamic


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.

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
It will not render any items, and will not throw any error.

Basically you can block error messages as well … es&s=onXLS

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.

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


       if (state!=1)

          setItemImage2(id, ‘closedFolder.gif’, ‘fecthing.gif’, ‘openFolder.gif’ )

       return true;


       if (state==1)

          setItemImage2(id, ‘closedFolder.gif’, ‘closedFolder.gif’, ‘openFolder.gif’ )

       return true;



It worked great.