关于Ext.window的隐藏(hide)和销毁(close)的问题
2012-06-28 17:42
316 查看
在这两天的开发中我碰到这样一个问题,在第一次打开window时数据正常,但是第二次及以后打开时现实的额数据任然是第一次打开的数据。
经查找发现此时window调用的关闭方式是hide而不是close,即每次关闭时实质上是没有关闭的只是把window隐藏了而已,此时只要把关闭方法用close即可,而且把closeAction:'close'这样配置即可。
但是此时问题又发生了,此时window打开一次后就无法打开了
代码:
这样修改后 就可以正常的打开了。
ps:注意红色部分的代码,及每段代码的位置.
本人认为出现此种情况的原因:改前 各组件对象只实例化了一次,window关闭后再打开时无法调到该组件,导致window无法显示
而将组件放到show方法里面后,每次调用show方法时组件都会被实例化一次,因此能能够正常显示。
经查找发现此时window调用的关闭方式是hide而不是close,即每次关闭时实质上是没有关闭的只是把window隐藏了而已,此时只要把关闭方法用close即可,而且把closeAction:'close'这样配置即可。
但是此时问题又发生了,此时window打开一次后就无法打开了
代码:
//关闭按钮 this.ButtonClose =new Ext.Button({ text:'关闭', id:'ButtonClose', width:200 }); //新增按钮 this.ButtonNewAdd =new Ext.Button({ text:'新增走访记录', id:'ButtonNewAdd', width:200 }); //******必须把new window的操作放在这个 show方法里面 否则执行close操作后第二次就无法打开***** this.win = new Ext.Window({ id:'checkInfoWin', layout:'fit', width:800, height:500, modal : true, draggable : true, resizable : false, closeAction: 'close', //close 关闭 hide 隐藏 animEl:'btnadd', title:"查看客户客走访信息", buttons : [this.ButtonNewAdd, this.ButtonClose], items : this.showTabPanel }); this.show = function(id,name){ this.win.show(); } this.closeWin = function(){ this.parentForm.store.reload(); this.win.close(); }
修改后的:
this.show = function(id,name){
//关闭按钮
this.ButtonClose =new Ext.Button({
text:'关闭',
id:'ButtonClose',
width:200
});
//新增按钮
this.ButtonNewAdd =new Ext.Button({
text:'新增走访记录',
id:'ButtonNewAdd',
width:200
});
this.win = new Ext.Window({
id:'checkInfoWin',
layout:'fit',
width:800,
height:500,
modal : true,
draggable : true,
resizable : false,
closeAction: 'close', //close 关闭 hide 隐藏
animEl:'btnadd',
title:"查看客户客走访信息",
buttons : [this.ButtonNewAdd, this.ButtonClose],
items : this.showTabPanel
});
this.win.show();
}
this.closeWin = function(){
this.parentForm.store.reload();
this.win.close();
}
这样修改后 就可以正常的打开了。
ps:注意红色部分的代码,及每段代码的位置.
本人认为出现此种情况的原因:改前 各组件对象只实例化了一次,window关闭后再打开时无法调到该组件,导致window无法显示
而将组件放到show方法里面后,每次调用show方法时组件都会被实例化一次,因此能能够正常显示。
相关文章推荐
- 关于Ext.window的隐藏(hide)和销毁(close)的问题
- 【原创】关于IE8上打印预览后window.close()无法关闭页面的问题
- MFC:关于MFC窗口对象(CWnd对象)与Window对象(HWND所指对象)的销毁问题
- 关于ext,根节点隐藏,做完全选与反选,拼接出错的问题
- Ext使用form布局时 使用hide()方法或者setVisible()隐藏textfile 等组件 filedLable不隐藏问题
- 关于手机上不能用window.close的问题
- ext window close() 问题
- Ext.window的close的问题
- 关于EXT的一点点中文乱码的小小问题.
- 关于Linux系统下在使用close关闭串口设备时引起的内核崩溃问题解决方法
- 关于close_wait状态的问题分析
- 关于ext多行下拉框的问题 lovcombo
- 关于window的端口查看及tomcat的端口修改问题
- 关于写ruby c ext 的一些问题(1)
- 关于window.open()中文传值乱码问题的解决方法
- 关于Linux与window文件互传问题
- IE10下 .hide()隐藏对象不生效(其它所有主流浏览器都没这个问题)的处理方式
- 关于Activity加载Fragment切换Show和Hide重叠问题
- ext.window和iframe传值的问题
- window.opener=null;window.close(),只支持IE6不支持IE7,IE8的问题