PDA

View Full Version : Tree Export Json



mmcc128
24 Nov 2010, 10:19 AM
Using a TreePanel with drag&drop enabled to allow users to reorder structure. Creating the tree based on existing json is done but is there a method to "extract" json from the modified tree to post back/save?

Screamy
24 Nov 2010, 10:41 AM
After looking through the API and source files, it looks like you'll have to build up the JSON yourself, by going after the Nodes of the TreePanel.

It looks like TreeNode (extended from Ext.data.Node) has public property attributes which will let you get at the detailed data of each node, including any children.

From there, I'd write a recursive routine which starts at the root tree node and builds up the JSON to be posted.

mmcc128
24 Nov 2010, 10:42 AM
I just came across this which is magically working.

http://www.sencha.com/forum/showthread.php?28456-How-to-save-a-tree-structure/page2

THANKS!!!