-
8 Dec 2011 10:11 PM #1
Unanswered: How to expand particular node in tree panel - Extjs 4
Unanswered: How to expand particular node in tree panel - Extjs 4
hi all,
i would like to know , How to expand the particular node in the tree panel?
Please share ur experience.
-
8 Dec 2011 11:51 PM #2
Nodes have an expand method:
http://docs.sencha.com/ext-js/4-0/#!...-method-expand
A node can also be created expanded:
http://docs.sencha.com/ext-js/4-0/#!...e-cfg-expanded
Trees have an expandPath method:
http://docs.sencha.com/ext-js/4-0/#!...hod-expandPath
The format used by expandPath is compatible with getPath:
http://docs.sencha.com/ext-js/4-0/#!...method-getPath
-
9 Dec 2011 12:34 AM #3
Hi,
can u give some working example?
-
9 Dec 2011 12:47 AM #4
You haven't given enough information on what you're trying to do for us to provide you with an example.
-
9 Dec 2011 1:18 AM #5
expand particular node in tree panel
expand particular node in tree panel
Code:var invTreeStore = Ext.create('Ext.data.TreeStore', { proxy : { type : 'ajax', url : 'lab_tree.class.php'//'get_tree_nodes.php' }, root : { text : 'Labs', id : '0|getLabs', expanded : true }, folderSort : true, sorters : [{ property : 'text', direction : 'ASC' }] }); var labTree = Ext.create('Ext.tree.Panel', { //title : 'labTree', renderTo : Ext.getBody(), id : 'labTree', lines : true, autoHeight : true, containerScroll : true, autoScroll : true, frame :true, iconCls : 'icon-basket', style : 'padding-bottom: 5px', store : invTreeStore,//powerTreeStore, rootVisible : false, //collapsed : true, listeners : { itemclick : function clickListener (view, rec, item, index, eventObj) { labhidden.setValue(rec.raw.chain['lab']); aislehidden.setValue(rec.raw.chain['aisle']); aislelochidden.setValue(rec.raw.chain['aisle_location']); deviceStore.load(); } }, dockedItems: [{ xtype: 'toolbar', items: [{ text: 'Expand All', handler: function(){ labTree.expandAll(); } }, { text: 'Collapse All', handler: function(){ labTree.collapseAll(); } }] }] });
This is my code for tree panel. i want to expand one particular node by default.
-
26 Sep 2012 1:52 AM #6
try this
try this
If you know the Id of the node you can do tree.expandPath(store.getNodeById(id).getPath())


Reply With Quote