PDA

View Full Version : Usage TreePanel as navigation



DmitryF
25 Jun 2012, 8:16 AM
Hello.

I have a panel with 2 items. The first is TreePanel.
How to load specific view (widget) to the second item (panel/container) when i clicked on a tree node?



...
xtype: 'panel'
layout: 'border',


items:
[{
xtype: 'treepanel',
region: 'west',
root: {...},
...
},
{
xtype: 'panel',
region: 'center',
...
}];

Tim Toady
25 Jun 2012, 8:22 AM
You will need to put a listener on your tree for an event like itemclick.http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Table-event-itemclick

Let us assume the panel in the center is a card layout. You would then use a reference to the center panel and call getLayout().setActiveItem( yourItem ) on it where yourItem is an index or itemId.

scottmartin
25 Jun 2012, 8:51 AM
There is a good example in the migration pack:
http://cdn.sencha.io/ext-3-to-4-migration-pack.zip

Scott.

DmitryF
25 Jun 2012, 9:36 AM
Thank you for help =D>