PDA

View Full Version : load and 'retrieve' data from treeview



oohogwash
28 May 2013, 4:40 AM
I have been able to load Ext.data.TreeStore form local json text and from a proxy into a treeviewdragdrop to get a nice tree view.... all good.
What I cannot do is access the data from he tree view so I can do stuff with it.
I have searched hi and low for an answer... in docs and web

Can anyone post an short example that populates as treeviewdragdrop (like the one in custom-drop-logic.js example) and then allows code to extract the node tree into a var / json object.

Thanks
Gavan

oohogwash
29 May 2013, 3:52 AM
I have been trying still to work this out, surely sencha can write the tree data back to var object.... the memory proxy demos dont show anything.... please help guys.

slemmon
29 May 2013, 10:07 PM
I'm not quite sure what you're looking to do based on your description, but it seems what you're after is the tree node's serialize() method.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.NodeInterface-method-serialize

oohogwash
29 May 2013, 11:31 PM
thanks slemmon, you solved it for me.
I was continually looking for the store to give me the data. But once I recieved your reply i relize the approach is to go to the node... the code just fell out... i really appreciate you help
Here is my simple dump

var tree = Ext.getCmp('tree-panel');
var rootNode = tree.getRootNode();
var json = rootNode.serialize(rootNode);

Please mark as resolved...