PDA

View Full Version : How to listen to window close event



chot2
30 Dec 2011, 11:02 PM
Hello everyone ,

Can some please let me know how to listen to a window close event ? Basically , I want hide a button when window is clicked and show it again when window's close icon is clicked .

I have tried the following scenario's

isExist = Ext.isEmpty(Ext.getCmp('idoftheextwindow'));
isShown = (isExist) ? Ext.getCmp('idoftheextwindow').isVisible() : false;

isExist is never true and when ever i give a id to window , window is getting displayed in the bottom of the page :D . I have looked in this example http://www.fusioncube.net/index.php/extjs4-capturing-window-header-close-button-click but can someone please provide me a detailed explanation :-|

xuzicn
31 Dec 2011, 1:03 AM
use beforeclose event

win.on('beforeclose', function() {
alert(10);
});

Farish
1 Jan 2012, 11:48 PM
you can also use the hide event on the window (like the beforeclose event illustrated above). Otherwise, what you can do is to set the modal config of the window to true. This way, the user cannot click on anything outside the window until its closed and you don't need to worry about showing and hiding the button (or other components which shouldn't be clicked while the window is visible).


modal: true

Regards,
Farish