PDA

View Full Version : How to catch a 'close' event on tab



hamelekh
4 May 2007, 1:44 PM
Big fan of the work you all have done! Great job!

Is there a way to listen for like an 'onClose' event on a tab? Then if there is, can we veto it. I have a case where the data in the tab may not be saved or valid. This would then need to alert the user and allow them to change the data before closing, or cancel their changes.

Thanks!

jack.slocum
4 May 2007, 5:42 PM
From the TabPanelItem docs under "Public Events":

beforeclose : (Ext.TabPanelItem this, Object e) TabPanelItem
Fires before this tab is closed. To cancal the close, set cancel to true on e. (e.cancel = true)

http://extjs.com/deploy/ext/docs/#output/Ext.TabPanelItem.html

MoShAn480
6 May 2007, 11:44 AM
Do you have any insight to why closing the tab via the rendered tab close button versus closing the tab using tabPanel.removeTab(tab) are different? Using tabPanel.removeTab(tab) to close the tab does not allow you to recreate the tab over again with the same tab id.

tryanDLS
6 May 2007, 12:00 PM
Do you have any insight to why closing the tab via the rendered tab close button versus closing the tab using tabPanel.removeTab(tab) are different? Using tabPanel.removeTab(tab) to close the tab does not allow you to recreate the tab over again with the same tab id.
You already started a thread with this question. Please don't ask the same thing in a different thread, just because you haven't got an answer yet.