PDA

View Full Version : How to load data in to one tree store(Memory proxy) from another tree store reader



pk.hafeez
8 Jan 2013, 7:05 AM
Hi,

I have couple of tree panels, each configured with individual tree stores. I have configured a proxy for one store. on load event of this, i am trying to load the second store(proxy memory) like below. But doesn't work.

_treeStore2 = Ext.create('Ext.data.TreeStore', {
model: 'Scenario',
proxy : {
type : 'memory'
}

});

_treeStore1 = Ext.create('Ext.data.TreeStore', {
model: 'Scenario',
root:'data1',
proxy : {
type : 'ajax',
url: '/proj/examples?id='+_Id,
reader : {
type : 'json',
root:'data1'
}
},
listeners: {
'load': {
fn: function(store, records, success, operations) {
_treeStore2.setRootNode(_treeStore1.getProxy().getReader().jsonData.data2);
}
}
});

Sample JSON data: {"data1":[{"name":"value","children":[]}],"data2":[{"name":"value","children":[]}]}

mitchellsimoens
10 Jan 2013, 10:09 AM
You would have to use the appendChild method on a node in the first store.