I am using ExtJS 4. I have created a tree panel as
var treeStore = Ext.create('Ext.data.TreeStore', {
root: {
text:'Reports',
expanded: true,
children: [
{
id: 'operationalNode',
text: 'Operational',
children: [{ text: "report1", leaf: true }]
},
{
id: 'managementNode',
text: 'Management',
children: [{ text: "report2", leaf: true }]
},
{
id: 'inventoryNode',
text: 'Inventory'
}
]
}
});
var treePanel = Ext.create('Ext.tree.TreePanel',{
animate:true,
layout:'fit',
height:400,
store:treeStore
});
Now I want to retrieve the 'Operational' child as
Ext.getCmp('operationalNode');
But it returns null.
Why is it so?
How can I retrieve that Node?
Is there any way to retrieve the Node by its name?
nodes are actual models that have the node interface . so you should just use getNodeById from the treestore
var node = treeStore.getNodeById('operationalNode')
your data is in node.data just like in any other models