最近在做一个政府项目,要求界面简单大方,统一风格,于是想到了整合ext+struts框架到项目中的念头,其中整合最多的是一大推的各种信息的增删查,少不了用到formpanel和弹出的window窗口,问题出现了:
首次能弹出window窗口,关闭后再无法显示,javascript错误出现“Error:null不是对象”,其实最关键是window的closeAction属性,要设置成hide,这样每次关闭只是隐藏而不是关闭(window destroy)
var onCreateClick = function() {
if(!win){
win = new Ext.Window({
id:'win',
title:'用户信息添加',
layout:'fit',
width:360,
height:430,
plain:true,
bodyStyle:'padding:5px;',
maximizable:false,
closeAction:'hide', ///这里是关键的地方
closable:true,
collapsible:true,
plain: true,
buttonAlign:'center',
items:createForm
});
}
createForm.form.reset();
win.show(this);
}
每次显示都正常,显示效果如下: