serializeTreeToJSON with checkbox state

Hi,

I’m using dhtmlx standard edition. I have noticed that serializeTreeToJSON method serializes only id, text and open attributes. Is there a way to serialize the tree saving also the checkbox states?
Probably I will pass professional edition because I have to serialize also UserData with setSerializationLevel method.

Hi
You need to set the 2th parameter in serialization level method:
docs.dhtmlx.com/doku.php?id=dhtm … tion_level
dhxTree.setSerializationLevel(true, true);

Hi Darya.
Thanks for your solutions. It works fine!
But now I have another problem: serializing an array as UserData fails :cry:
I’ll show you an example of serialization:

{“id”:“0”, “item”:[{ “id”:“category|category0|”, “open”:“1”, “text”:“category1”, “im0”:“leaf.gif”, “im1”:“folderOpen.gif”, “im2”:“folderClosed.gif” , “checked”:"-1", “userdata”:[{ “name”:“type” , “content”:“category” },{ “name”:“description” , “content”:“category description3” },{ “name”:“properties” , “content”:"[object Object]" }], “item”: …

Have you PRO version? Getting userdata is available only in PRO version.

dhtmlx.com/docs/products/dht … data.html# - here is a sample of getting it

Thank you Darya :wink:

You are welcome!