View Full Version : Tree Panel JSON updation

6 Oct 2009, 10:46 AM
Hi all,

I have a Tree panel currently rendering from a JSON that i am making an AJAX request. Afterward i am adding some more new nodes dynamically. Now i am trying to update the same JSON file with existing and new nodes. I am using following code for it.

var treePanel = Ext.getCmp('tree_panel');
var getRootNode = treePanel.getRootNode();

url : './php/ajax/metadata-json.php',
method: 'POST',
params: {rootNode:Ext.encode(getRootNode.attributes)},
success: function (result, request)
failure: function (result, request)
Ext.MessageBox.alert('Failed', result.responseText);

My problem is i am able to update the JSON file but with old nodes. New dynamically created nodes are not being fetched as Ext.encode(getRootNode.attributes) fetches old existing nodes only. How can i update it with both existing and new dynamically created nodes?

6 Oct 2009, 10:57 PM
I was doing a little research on it and found that when i am making an alert of treePanel.getNodeById(getRootNode).attributes.children.length;
then i am getting total length of existing node(not dynamically added new nodes). But when i am making an alert of
then i am getting total length of treenode including dynamically added new nodes.
:-/ Is this a bug in ExtJS or am i missing some configuration while setting treenode?