javascript ExtJS:销毁窗口,配置“closeAction”设置为“隐藏”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15293229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ExtJS: Destroy window with config 'closeAction' set to 'hide'
提问by Joseph Victor Zammit
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. I need to destroythe window in the sense of destroy
as implied by the Sencha docs:
调用close()
上myWin
,因此只是隐藏的窗口。我需要销毁destroy
Sencha 文档所暗示的意义上的窗口:
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.
从 DOM 中移除窗口并销毁它和所有后代组件。该窗口将无法通过 show 方法重新显示。
What did I try?I tried:
我尝试了什么?我试过:
calling
destroy
directly on the window object:myWin.destroy();
setting
closeAction
todestroy
prior to callingclose()
:win.closeAction='destroy'; win.close();
destroy
直接在 window 对象上调用:myWin.destroy();
在调用之前设置
closeAction
为:destroy
close()
win.closeAction='destroy'; win.close();
In both cases, myWin
is simply hidden rather than destroyed. Any thoughts?
在这两种情况下,myWin
都只是隐藏而不是销毁。有什么想法吗?
回答by VisioN
Method destroy()
should successfully remove the window object from the DOM. In order to illustrate this you can check the basic example in JSFiddle.
方法destroy()
应该成功地从 DOM 中删除 window 对象。为了说明这一点,您可以查看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()
。
回答by sravan kumar
Are you want to destroy the window.use below code
你想销毁window.use下面的代码
Ext.getCmp('Window Id').destroy();