为什么我不能两次显示新的Ext.Window

时间:2023-02-12 08:46:03

I have a html with one div and two scripts with Ext Js 3.4.0

我有一个带有一个div的html和两个带有Ext Js 3.4.0的脚本

<script type="text/javascript" src="js/listaBancos.js"></script>

The file listaBancos.js show a Grid with toolbar button in the divListaBancos, the first time i click the button "Agregar" and i see the Window declared in altaBanco.js.

文件listaBancos.js在divListaBancos中显示一个带有工具栏按钮的Grid,第一次单击按钮“Agregar”,我看到在altaBanco.js中声明了Window。

==============Part of the grid in listaBancos.js============

============== listaBancos.js中的部分网格============

 tbar:[{
    text:'Agregar',
    tooltip:'Agrega un banco',
    iconCls:'add',
    handler: agregaBanco
}]

function agregaBanco(){
var win =Ext.getCmp('myWin');
win.show();

}

}

==============Window declared in altaBanco.js================

==============在altaBanco.js中声明的窗口================

var winAltaBanco = new Ext.Window({
    id     : 'myWin',
    height : 250,
    width  : 400,

});

When i close the window then click the button again the windows doesn't showed.

当我关闭窗口然后再次单击按钮窗口没有显示。

Can you help me ???

你可以帮我吗 ???

3 个解决方案

#1


0  

Make sure in window config close action is set to hide.

确保在窗口配置关闭操作设置为隐藏。

closeAction:'hide'

check this

检查一下

#2


1  

The default close action of a windows is close, i.e., it destroys the component, hence it cannot be accessed using Ext.geCmp() again since it doesn't exist on the DOM anymore. To achieve what you want either set closeAction : hide or

窗口的默认关闭动作是关闭的,即它会破坏组件,因此无法再使用Ext.geCmp()访问它,因为它不再存在于DOM上。要实现你想要的设置closeAction:hide或

var cmp = Ext.getCmp('myId');
if(!cmp)
{
cmp = new Ext.Window({
  id : 'myId'
});
}
cmp.show();

Prefer hiding to recreating.

喜欢隐藏重新创建。

#3


0  

There is no need to make any trick, simply remove your window id. In ExtJS component ids must be unique.

没有必要做任何技巧,只需删除您的窗口ID。在ExtJS中,组件ID必须是唯一的。

#1


0  

Make sure in window config close action is set to hide.

确保在窗口配置关闭操作设置为隐藏。

closeAction:'hide'

check this

检查一下

#2


1  

The default close action of a windows is close, i.e., it destroys the component, hence it cannot be accessed using Ext.geCmp() again since it doesn't exist on the DOM anymore. To achieve what you want either set closeAction : hide or

窗口的默认关闭动作是关闭的,即它会破坏组件,因此无法再使用Ext.geCmp()访问它,因为它不再存在于DOM上。要实现你想要的设置closeAction:hide或

var cmp = Ext.getCmp('myId');
if(!cmp)
{
cmp = new Ext.Window({
  id : 'myId'
});
}
cmp.show();

Prefer hiding to recreating.

喜欢隐藏重新创建。

#3


0  

There is no need to make any trick, simply remove your window id. In ExtJS component ids must be unique.

没有必要做任何技巧,只需删除您的窗口ID。在ExtJS中,组件ID必须是唯一的。