简体   繁体   English

ExtJS:销毁窗口,配置'closeAction'设置为'隐藏'

[英]ExtJS: Destroy window with config 'closeAction' set to 'hide'

I have a window with closeAction configured to 'hide' on instantiation: 我有一个窗口,其closeAction配置为在实例化时'hide'

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

Calling close() on myWin therefore simply hides the window. 因此,在myWin上调用close()只会隐藏窗口。 I need to destroy the window in the sense of destroy as implied by the Sencha docs: 我需要按照Sencha文件暗示的destroy意义破坏窗口:

remove the window from the DOM and destroy it and all descendant Components. 从DOM中删除窗口并销毁它和所有后代组件。 The window will not be available to be redisplayed via the show method. 该窗口无法通过show方法重新显示。

What did I try? 我尝试了什么? I tried: 我试过了:

  1. calling destroy directly on the window object: 直接在window对象上调用destroy

     myWin.destroy(); 
  2. setting closeAction to destroy prior to calling close() : 在调用close()之前将closeAction设置为destroy

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

In both cases, myWin is simply hidden rather than destroyed. 在这两种情况下, myWin只是隐藏而不是被破坏。 Any thoughts? 有什么想法吗?

Method destroy() should successfully remove the window object from the DOM. 方法destroy()应该成功从DOM中删除窗口对象。 In order to illustrate this you can check the basic example in JSFiddle . 为了说明这一点,您可以查看JSFiddle中的基本示例。

After calling myWin.destroy() the structure is cleared and it becomes not possible to reinvoke the window with myWin.show() . 在调用myWin.destroy() ,结构被清除,并且无法使用myWin.show()重新调用窗口。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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