PDA

View Full Version : Adding tabs with content-load from an url to a tabpanel



Shining77
26 Nov 2011, 12:12 PM
I have the following problem by adding tabs with content-load from an url to a tabpanel:

var tabPanel = new Ext.TabPanel({
deferredRender:false,
autoScroll: true
...
});

var viewport = new Ext.Viewport({
...,
items:[{
region:'center',
plain:true,
items: [tabPanel]
},{
region: 'west',
collapsible: false,
xtype: 'tabpanel',
...,
items:[{
title: 'Menu',
xtype: 'treepanel',
...,
loader: new Ext.tree.TreeLoader(),
root: new Ext.tree.AsyncTreeNode({
expanded: true,
children: [{
text: 'Test',
id: '../admin/customerBranch_index.htm',
leaf: true
}]
}),
rootVisible: false,
listeners: {
click: function(n) {
tabPanel.add({
title: n.attributes.text,
autoLoad: {url: n.attributes.id, scripts: true, scope: this},
closable:true
}).show();
}
}

I have a viewport with a treepanel as menu in the west and a tabpanel as maincontent panel in the center.
When you click on an item in the treepanel in the menu, a new tab in the center-tabpanel shall be created with content from an url.

The strange problem:
When I click the first time, everything is ok and the new tab is created with the correct content.
But when I click another time, the tab is created correctly again, but with empty content and the content from the url is rendered in the body of the first tab.

What might be the problem here, any ideas?

mitchellsimoens
27 Nov 2011, 7:39 AM
That is very odd as there isn't anything that sticks out to me that is a problem.