dhtmlxTree - serializeTree() a tree that uses setXMLAutoLoa

If a node is opened when you serializeTree() a tree that uses setXMLAutoLoading() and then load it back with loadXMLString() then the nodes opened are seen with the [-] symbol but any node not opened that has children loses the [+] symbol.

The problem - if I use setXMLAutoLoading and loadXML then dhtmlxTree shows the tree with a closed node that has a [+] icon to indicate it has children. If I serialise the tree and load it back using loadXMLString() then the tree no longer has the [+] icon ie its as if its only loading the first level. But if nodes are opened prior to the serialisation then when loaded back those nodes are still seen to be open and can be ie loaded more than one level but all [+] symboils are lost.

1) function doOnLoad() {


tree.loadXML(); // get first level



2) function mySerialise {

tree.setSerializationLevel(false, true);

var x = tree.serializeTree();




There was a bug in the serialization with autoloading. The fix will be sent by email (it will contain the solution for nocheckbox attribute).

Fix works but it does not pick up style content in this case text color and background color. I switched to aCol but does mean background color is lost.

Unfortunately “style” attribute can not be serialized.

The possible solution is userdata. It is additional node infromation that can be set either in xml:

<item …>background-color:red;

or by tree API:


Userdata can be serialized (the 1st parameter of setSerializationLevel method should be true). So you will get the style (or any other data) in the serialized string.


I have the same problem using v 2.1 of dhtmlXGrid. Is there a way to have a fix for it ?

Best regards

It possible to serialize back “style” value which is loaded from XML , but if we are talking about styles, which was set by setRowText, setCellText commands - there is no simple way.

In common case - solution similar to above one, with storing new styles in userdata and serializing userdata, can be used with the grid the same as with tree.