PDA

View Full Version : Ext.ux.GroupTabPanel in Window fails on win.close



deeckay
15 Feb 2010, 10:00 PM
Hi,
Am using the GroupTabPanel in a window, when I use win.close() the application throws an error that 'item is undefined', in GroupTabs.js line 208. Any other subsequent attempts to open the window fail

Platform: Extjs 3.1.1

Here is my sample code



Ext.onReady(function(){
var win;
var button = Ext.get('show-btn');

button.on('click', function(){
var contentPane = new Ext.ux.GroupTabPanel({
tabWidth: 130,
activeGroup: 0,
items :[{
items: [{
title: 'User Info',
iconCls: 'x-icon-users',
tabTip: 'Users tabtip',
style: 'padding: 10px;',
html: "Form with user info "
}]
}, {
expanded: true,
items: [{
title: 'User Settings',
iconCls: 'x-icon-configuration',
tabTip: 'Configuration tabtip',
style: 'padding: 10px;',
html: "User Settings"
}]
}]
})

if(!win){
win = new Ext.Window({
layout:'fit',
width:800,
height:500,
maximizable : true,
title : "Application Win",
plain : true,
items :[contentPane] ,
buttons: [{
text:'Submit',
disabled:true
},{
text: 'Close',
handler: function(){
win.close();
}
}]
});
}
win.show(this);
});
});

deeckay
16 Feb 2010, 12:43 AM
Commenting out the code in beforeDestroy in GroupTab.js seems to have worked for me.

Is there a possibility the application is calling onRemove: function(tp, item) on items that have already been destroyed previously?



beforeDestroy: function(){
//Ext.TabPanel.prototype.beforeDestroy.call(this);
//this.tooltip.destroy();
}

franck34
28 Feb 2010, 1:38 AM
Same for me, here is the override :



Ext.override(Ext.ux.GroupTab, {
beforeDestroy: function(){
}
});

franck34
2 Mar 2010, 1:49 AM
with this override, no more error related to onRemove item.un, but, does destroy continu to work recursivity ? mmmm

franck34
2 Mar 2010, 2:05 AM
yes, this override break destroy() recursivity.

Here is the "good" ? way (it's work for me):



Ext.override(Ext.ux.GroupTab, {
onRemove: function(tp, item){
if (!item) return;
Ext.destroy(Ext.get(this.getTabEl(item)));
this.stack.remove(item);
item.un('disable', this.onItemDisabled, this);
item.un('enable', this.onItemEnabled, this);
item.un('titlechange', this.onItemTitleChanged, this);
item.un('iconchange', this.onItemIconChanged, this);
item.un('beforeshow', this.onBeforeShowItem, this);
if (item == this.activeTab) {
var next = this.stack.next();
if (next) {
this.setActiveTab(next);
}
else if (this.items.getCount() > 0) {
this.setActiveTab(0);
}
else {
this.activeTab = null;
}
}
},

beforeDestroy: function(){
if (!this.toolbars) this.toolbars=[];
Ext.TabPanel.prototype.beforeDestroy.call(this);
this.tooltip.destroy();
}
});

franck34
2 Mar 2010, 2:07 AM
deeckay is it possible you rename this thread using [BUG] in front of the title ?

thanks

deeckay
11 Mar 2010, 5:07 AM
Thanx for that. I have been unable to rename the thread. How do I go about doing that?

diaz
16 Mar 2010, 8:00 AM
Really great !!! I worked fine for me and fixed those bugs !!!
THANKS