jQuery easyui 1.2.5 window、dialog发送两遍请求(刷新两次)
dialog继承window,window继承panel、
以dialog为例说明,创建dialog和刷新dialog会发送两遍请求(刷新两次)、本人觉得这是bug、解决办法如下,
var channelId="1000";
var openedInfoEdit=false
function openInfoEdit(id){
var param="";
if(id!=""){
param +="&id="+id;
}
if(!openedInfoEdit){
$('#infoEdit').dialog({
title:"编辑信息",
width:600,
height:200,
minimizable:false,
maximizable:true,
//resizable:true,
//cache: true,
href:"/cms/cms/info_detail.action?channelId="+channelId+param,
closable: true,
closed: true //已关闭
});
$('#infoEdit').dialog('open'); //再open
openedInfoEdit=true;
} else {
$('#infoEdit').dialog('open'); //先open再refresh
$('#infoEdit').dialog('refresh',"/cms/cms/info_detail.action?channelId="+channelId+param);
}
}
关键是closed: true、$('#infoEdit').dialog('open');
因为首次open时会向服务器发出请求,所以在创建时先标识他是关闭的再open,
刷新时先open,再refresh
成功解决提交两次请求的问题。