Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Atanas Koev on Sep 29, 2008 02:08
open dhtmlx forum
DHtmlXTree saveState / loadState

Hi,

I'm using DHtmlXTree LodXml feture and after that I'm trying to save the tree state into a cookie. The code looks something like this:

// Tree creation ...

var xml = '<tree id="0"><item id="some"><itemtext><![CDATA[ <a href="http://any.url/here">any test</a>]]></itemtext></item></tree>';

tree.loadXMLString(xml);
tree.saveState("stateCookie");

// ... And after that

tree.loadState("stateCookie");

It appears that the tree is not loaded correctly. I think this is because the saveStatemethod uses serializeTree which does not deal with CDATA correctly (the item's text is always serialized as a XML attribute).

Are my observations correct and How can I save and load the state of a tree with CDATA in the items's text?

Thanks in advance.

Regards,

Atanas
Answer posted by Support on Sep 29, 2008 02:34
>>Are my observations correct and How can I save and load the state of a tree with CDATA in the items's text?
Yes, during serialization,tree always use XML attribute for text storing, so it is not possible to use CDATA section, but you can use auto-escaping, which will allow to store complex content in XML attributes

tree.setSerializationLevel(false,false,true)