PDA

View Full Version : Event "beforedestroy" fired too late on tab close



h.koch
19 Jun 2011, 2:56 AM
Hi,

closing tabs drives me nuts ;)
I want to implement a user choice if he really wants to close the tab when clicking on the "x" ("Close Tab") icon. Having a separate button for closing the tab shows that it's working when a separate "destroy()" is called, everything works fine. But when defining a listener on that event, a simple "alert" shows that the destroying cannot be overridden by a "return false" any more because it's already destroyed. This only happens when clicking the "x" of the closable tab. Have a look at the tab after the popup arises: it's gone.

Example code:


title:'my sample tab',
layout: 'border',
items: [{
xtype: 'NewSendJobUi',
region: 'center',
id: uniqueTabId,
data: uniqueTabId
}],
closable:true,
id: 'newSendJob_' + uniqueTabId,
listeners: {
'beforedestroy': function() {
alert('before destroy');
return false;
}
}