PDA

View Full Version : how to default select a node of a tree panel in extjs 3.4



@naresh
8 Jun 2014, 9:42 PM
I have a tree panel which have 10 childrens .I want to select default third child of them. what can i do . I am using this code for select but its not work.


var root = Ext.getStore('MyStore').getRootNode();
var firstChildNode = root.findChild('leaf', true, true);
Ext.getCmp('treePnl').getSelectionModel().select(firstChildNode);

mitchellsimoens
13 Jun 2014, 11:57 AM
Is it's parent expanded at the time of selection?

@naresh
13 Jun 2014, 9:51 PM
Thanks for reply ,

Here is my code which i am using :

var appManager = new Ext.Panel({
title: 'My Panel',
layout:'fit',
items : [new Ext.tree.TreePanel({
id:'appManagerMenu',
loader: new Ext.tree.TreeLoader(),
rootVisible:false,
lines:false,
autoScroll:true,
root: new Ext.tree.AsyncTreeNode({
children:[
{
text:'Create App',
iconCls:'app42CreateApp',
leaf:true,
},
{
text:'App DashBoard',
expanded : false,
iconCls:'app42AppDash',
leaf:true
}]
}]
})
})
So i want to App DashBoard child is selected when the panel is called.