楔子
简单的使用记录。使用Windows窗体打开一个页面,选择数据传递给父页面。并关闭子页面
父页面打开窗体
父页面div和js
<div id="winSelectJsp"></div>
//使用这用方式,父页面的可以执行
function selectSource(){
$('#winSelectJsp').window({
title:'选择- 源字典',
width:950,
height:500,
modal:true,
draggable : false,
shadow: true,
content:"<iframe src='${basePath}/view/qyzx/ywgn/dic/selectDic.jsp' height='100%' width='100%' frameborder='0px' ></iframe>"
});
}
子页面操作
子页面传递值给父页面
/* 添加数据字典对照 */
function btn_add(){
var row = $('#grid').datagrid("getSelected");
if(row==null){
$.messager.alert('消息', '该操作有且只能选择一条记录!' ,'question');
return false;
}else{
if(row.dicitemstatus == '2'){
$.messager.alert('消息', '该状态为未启用 请勿选择 !','question');
return false;
}
parent.$("#sourcedictypeshow").textbox("setValue" ,parent.parent.parent.formartDic($("#dictype").textbox("getValue"),"1205"));
parent.$("#sourcedictype").val($("#dictype").textbox("getValue") );
parent.$("#sourcediccode").textbox("setValue" ,$("#diccode").textbox("getValue"));
parent.$("#sourcedicname").textbox("setValue" ,$("#dicname").textbox("getValue"));
parent.$("#sourcedicitemcode").textbox("setValue",row.dicitemcode);
parent.$("#sourcedicitemname").textbox("setValue",row.dicitemname);
parent.$("#sourceDiitemid").val(row.id);
$('#grid').datagrid('clearSelections');
parent.$('#winSelectJsp').window("close");
}
}