论坛首页 Web前端技术论坛

jqueryUI插件$("#id")dialog的形式弹出框里边数据丢失(编辑操作)

浏览 2135 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2015-08-27  
jsp页面js文件引入:
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/css/jquery-ui-1.8.18.custom.css">
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/notebook/notebook_files/bootstrap.css">

<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/js/ZebraDatepicker/public/default.css">
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/js/ZebraDatepicker/public/reset.css">
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/js/ZebraDatepicker/public/style.css">

<script type="text/javascript" src="${pageContext.request.contextPath}/js/ZebraDatepicker/core.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/ZebraDatepicker/zebra_datepicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/businessmana/radiationmana/list.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/laydate/laydate.js"></script>
用于承载弹出框的DIV标签:
<div id="editradiationdiv" style="display: none">
<table style="border:1px; border-color: red;width: 100%">
<thead>
<tr>
<td>货物名称</td><td>辐照数量</td><td>辐照重量</td><td>辐照方式</td><td>辐照时间</td>
</tr>
</thead>
<tr>
<td><input id="divcargoname" name="divcargoname" type="text" disabled="disabled" /> <input type="hidden" id="receiveorgid" name="receiveorgid" /> </td>
<td>
<input type="text" id="irradednum" name="irradednum" /> &nbsp;
<input type="hidden" id="hiddenoldirradednum"/>
<crazy:dictselect id="showcountorginfos" name="showcountorginfos" collection="${showcountorginfos}"  ></crazy:dictselect>
</td>
<td> <input type="text" id="cargoweight" name="cargoweight" /> </td>
<td><crazy:dictselect id="irradtypes" name="irradtypes" collection="${irradtypes}"  ></crazy:dictselect></td>
<td> <input type="text" id="irradtime" name="irradtime" /> <crazy:dictselect id="timeorgs" name="timeorgs" collection="${timeorgs}"  ></crazy:dictselect> </td>
</tr>
</table>

<table>
<thead>
<tr>
<td>日期</td>
<td>序号</td>
<td>交接时间</td>
<td>首位吊具号</td>
<td>辐照批号</td>
<td>入场时间</td>
<td>吊具号码</td>
<td>装载模式</td>
<td>运行参数</td>
<td>运行圈数</td>
<td>变动说明</td>
<td>下圈开始时间</td>
<td>备注</td>
</tr>
</thead>
<tr>
<td> <input type="text" id="doirraddate" placeholder="格式:yyyy-mm-dd" /> </td>
<td> <input type="text" id="ordernum" /> </td>
<td> <input type="text" id="connecttime"/> </td>
<td> <input type="text" id="firstspreadernum" /> </td>
<td> <input type="text" id="irradbatchnum" /> </td>
<td> <input type="text" id="entrancetime" /> </td>
<td> <input type="text" id="spreadernum" /> </td>
<td> <crazy:dictselect id="loadmodel" name="loadmodel" collection="${loadmodel}"  ></crazy:dictselect>  </td>
<td> <input type="text" id="runparam" /> </td>
<td> <input type="text" id="runcycle" /> </td>
<td> <input type="text" id="changedesc" /> </td>
<td> <input type="text" id="nextcyclestarttime" /> </td>
<td> <input type="text" id="mask" /> </td>
</tr>
</table>
</div>
弹出框js注册代码:
function goeditradiation(id,receivemgrid){
globalstillid = id+"-"+receivemgrid;
//在此初始化(存在bug)
$("#editradiationdiv").dialog({
autoOpen : false,// 设置对话框打开的方式 不是自动打开
show : "bind",
hide : "explode",
modal : true,
height : 350,
width : 900,
title: "编辑",
buttons : {
'保存' : function() {
var irradednum= document.getElementById("irradednum").value;
var hiddenoldirradednum= document.getElementById("hiddenoldirradednum").value;
if(parseInt(irradednum) > parseInt(hiddenoldirradednum)){
alert("辐照数量不能超过已有货物数量!");
return;
}
if(!CommnUtil.validatetime($("#doirraddate").val())){
alert("日期格式错误!\n 格式:yyyy-mm-dd");
return;
}
if(CommnUtil.haveOneTagIsNull("doirraddate,ordernum,connecttime,firstspreadernum,irradbatchnum,entrancetime,spreadernum,runparam,runcycle,changedesc,nextcyclestarttime"))
{
alert("标红信息必须填写!");
return;
}
saveradiation();
$(this).dialog("close");
},
"取消" : function() {
$(this).dialog("close");
}
},
open : function(ev, ui) {

// CommnUtil.cleanInputValue("addcargoname,org,irradtype,irradtime,timeorg");
},
close : function(ev, ui) {
//CommnUtil.cleanInputValue("divcargoname,receiveorgid,irradednum,hiddenoldirradednum,showcountorginfos,cargoweight,irradtypes,irradtime,timeorgs");
}
});
initradiation();
$('#editradiationdiv').dialog('open');
}

弹出框内部数据初始化代码:
function initradiation(){
var id = globalstillid.split("-")[0];
var data = CommnUtil.normalAjax("/business/receivingmana/goradiation.do","id="+id, "json");
if(CommnUtil.notNull(data)){
alert("irradednum : "+data.cargocount+"\n"+"cargoweight : "+data.cargoweight+"\n"+"irradtime : "+data.irradtime);
$("#receiveorgid").val(data.receiveorgid);
$("#divcargoname").val(data.cargoname);
$("#hiddencargoid").val(data.cargoid);
//$("#irradednum").val(data.cargocount);//jquery可能与jquery的弹框有冲突使用此种方式无效改用如下方式
document.getElementById("irradednum").value=data.cargocount;
$("#hiddenoldirradednum").val(data.cargocount);//
$("#showcountorginfos").find("option[value='"+data.countorg+"']").attr("selected",true);
//$("#cargoweight").val(data.cargoweight);//jquery可能与jquery的弹框有冲突使用此种方式无效改用如下方式
document.getElementById("cargoweight").value=data.cargoweight;
$("#irradtypes").find("option[value='"+data.irradtype+"']").attr("selected",true);
//$("#irradtime").val(data.irradtime);//jquery可能与jquery的弹框有冲突使用此种方式无效改用如下方式
document.getElementById("irradtime").value=data.irradtime;
$("#timeorgs").find("option[value='"+data.irradtimeorg+"']").attr("selected",true);
}
}
问题::
弹出框是编辑操作,通过ID取的数据,然后通过initradiation()这个js函数展现数据,初始化的值能alert出来,我也用了纯dom往输入框(input标签)里边塞值了,但是就是不显示。。。和解?
万能的吧友。。。
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics