PDA

View Full Version : panel.add in same tab



veg
27 Nov 2007, 12:46 AM
I have a strange problem when dynamically adding a tab to TabPanel. In FF2.0.0.9 it works fine. in IE7 the tab is added but the content of the new tab is added to the previous tab that was displayed.

current code (part of main viewport):

mainFunc.addTab = function(oUri,oParams,oTitle,oTabID){
//var oPanel = Ext.getCmp('center-panel');
var oPanel = Ext.getCmp('centerPanel');
var tabItem;
if (!Ext.getCmp('tab-'+oTabID)){
oPanel.beginUpdate();
tabItem = new Ext.Panel({
id:'tab-'+oTabID,
title:oTitle,
tabtip:oTitle,
iconCls:'tabs',
autoScroll:true,
autoWidth:true,
enableTabScroll:true,
monitorResize:true,
monitorWindowResize:true,
autoLoad: {url:oUri, params:oParams, scripts:true, deferredRender:false},
closable:true
});

oPanel.add(tabItem);
oPanel.endUpdate();
oPanel.doLayout();
Ext.getCmp('tab-'+oTabID).show();
}else{
oPanel.setActiveTab(Ext.getCmp('tab-'+oTabID));
}
}

the call is made from a menu AND from a GRID in a tab added through the function above:

grid.on('rowdblclick', function(grid, rowIndex, e) {
var selectedId = store.data.items[rowIndex].id;
var record = store.data.items[rowIndex];

var selectedName = record.get('acc_name');
mainFunc.addTab('/crm/views/accountDisplay.cfm','t='+selectedId,selectedName,selectedId);
},null, {delegate:'a'});

hope someone could shed some light on this problem because it is destroying my much needed rest at night ~o)

veg
29 Nov 2007, 2:25 PM
:-/

tryanDLS
29 Nov 2007, 2:54 PM
Why are you calling beginUdpate/endUpdate? Those are not needed in 2.0.

veg
30 Nov 2007, 1:42 AM
i have tried so many different techniques to get the functions to behave the same in IE and FF but in IE 7 it still doesnt work..

i agree the beginupdate/endupdate isnt necessary. i added hoping ext would treat it in a transaction-like manner ...

plz try too look past the obsolete codes.. the core functionality of adding a tab from within a tab doesn;t work right i think. and i sincerely hope its because of my prototyped code snippets but i think its because of a bug in ext2.......