PDA

View Full Version : How to expand specific tree node instead of complete tree hierarchy using Ext JS 3.4



ASG_team
30 Jul 2013, 3:05 AM
Whenever a new node is added to the tree , tree should expand only upto that newly added node.
A1
A11
A111
A112
A113
A22
A211
A212
A213
A2
A21
A221
A222
AS per the requirement, if user adds a new node under 'A111', the tree must be expanded till the newly added node (A1-A11-A111-NewNode) and other nodes under A1 (A22) should be collapsed.
We tried the below code options and able to expand the tree, however 'A22' node is also gets expanded , this should not happen.
newNode.bubble(function(newNode){newNode.expand(false)});
or
treePanel.tree.getNodeById(newNode.id).expand(false);
Please provide thoughts to resolve this issue.
Thanks

slemmon
31 Jul 2013, 4:32 PM
I believe expandPath is what you'll need to use to expand just a specific path - in this case from root to the newly added node.
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.tree.TreePanel-method-expandPath