Ext.Window中closeAction的自定义函数

时间:2016-07-12 10:22:41

标签: extjs window handler

我有如下的extjs窗口,

var popupWindow = me.popupWindow = new Ext.window.Window({
                    autoHeight: true,
                    itemId: 'popup',
                    cls: 'premier-window',
                    width: 550,
                    height: 280,
                    layout: {
                        pack: 'center'
                    },
                    shadow: false,
                    modal: true,
                    frame: false,
                    resizable: false,
                    isPremierPanel: true,
                    usePremierCloseButton: true,
                    closeAction: 'hide',
                    dockedItems: [
                        {
                            dock: 'bottom',
                            xtype: 'toolbar',
                            itemId: 'button_toolbar',
                            style: 'background:#F5F3F4;broder:0',
                            items: [
                            {
                                dock: 'bottom',
                                xtype: 'button',
                                itemId: 'btnOk',
                                style: 'margin-left:230px;background:#D3D3D3;',
                                text: 'OK',
                                width: 70,

                              handler: me.okClicked,
                                scope: me
                            } 
                            ]
                        }
                    ],
                    style: 'background-color:#F5F3F4; font-size:11px; padding-bottom:10px; margin-left:10px;',
                    html: '<div style="padding-left: 7px;padding-right: 7px;padding-top: 7px;font-size:12px;">'  
                });
                popupWindow.show();
                popupWindow.setTitle('Restricted Access');

如何自定义extjs窗口的closeAction功能?

我希望在点击窗口的默认关闭按钮时执行除销毁或隐藏窗口之外的其他操作。

1 个答案:

答案 0 :(得分:1)

listeners:{
    beforeclose:function() {
        if(I_DONT_WANT_TO_CLOSE) {
            doSomethingAndDontCloseTheWindow()
            return false;
        }
    }
    close:function() {
        doSomethingAfterWindowHasBeenClosed();
    }
}