PDA

View Full Version : Newbie question: Use a TreeStore as menu



blade226
6 Feb 2012, 11:20 PM
Hello,

i build a small Site (Viewport). In west is a treepanel und in center a tabpanel. Now i want to click on a part of the treepanel and a new tab should be open.
I searched for a solution in sencha examples, but i don't get it right.

Code:

var west = Ext.create ("xwest",{
region: "west",
items : [ {
xtype : "panel",
region : "west",
width : 200,
items :[

{
xtype : "treepanel",
store: treestore
}]

}]
});

var mitte = Ext.create ("xmitte",{
region: "center",
items : [{
xtype : "tabpanel",
id : 'tabs',
activeTab: 0,
items : [

{
title : "Diagramm",
height : "100%",
width : "100%",
closable: true,
items: [diagr]

},
{
title : "Daten",
closable: true,
items: [artikelGrid]
}
]
}


]
});

Please: I need help

THX

chramer
6 Feb 2012, 11:34 PM
Try this...


{
xtype : 'treepanel',
store : treestore,
listeners : {
'select' : function(rowmodel, record) {
mitte.getComponent('tabs').add({title : record.get('Name'), itemId : record.getId()});
}
}
}

blade226
6 Feb 2012, 11:38 PM
Sorry,
I've been looking forward to early



Now, on every Text/Point a new tab opens. I want to use it as a menu.
For Example:
Click on: Beschreibung -> a tab named "Beschreibung" with a specific content opens. The root directory of the treepanel may not open a tab.