简体   繁体   中英

ExtJS: Destroy window with config 'closeAction' set to 'hide'

I have a window with closeAction configured to 'hide' on instantiation:

var myWin = Ext.create('Ext.window.Window', {
    ...
    closeAction:'hide',
    ...
});

Calling close() on myWin therefore simply hides the window. I need to destroy the window in the sense of destroy as implied by the Sencha docs:

remove the window from the DOM and destroy it and all descendant Components. The window will not be available to be redisplayed via the show method.

What did I try? I tried:

  1. calling destroy directly on the window object:

     myWin.destroy(); 
  2. setting closeAction to destroy prior to calling close() :

     win.closeAction='destroy'; win.close(); 

In both cases, myWin is simply hidden rather than destroyed. Any thoughts?

Method destroy() should successfully remove the window object from the DOM. In order to illustrate this you can check the basic example in JSFiddle .

After calling myWin.destroy() the structure is cleared and it becomes not possible to reinvoke the window with myWin.show() .

你想破坏窗口吗?使用下面的代码

Ext.getCmp('Window Id').destroy();    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM