easyui Dialog扩展建多个窗口问题
我把Dialog扩展了:
$.modalDialog = function(options) {
//if ($.modalDialog.handler == undefined) {// 避免重复弹出
var opts = $.extend({
title : '',
width : 840,
height : 680,
modal : true,
onClose : function() {
$.modalDialog.handler = undefined;
$(this).dialog('destroy');
},
onOpen : function() {
parent.$.messager.progress({
title : '提示',
text : '数据处理中,请稍后....'
});
}
}, options);
opts.modal = true;// 强制此dialog为模式化,无视传递过来的modal参数
return $.modalDialog.handler = $('<div/>').dialog(opts);
//}
};
现在的问题是,父窗口创建a子窗口, a子窗口在创建b子窗口,
如果在a子窗口中的handler : function() {}用parent.$.modalDialog.handler.find('#id') 可以获取b子窗口的任何属性,
而在父窗口中handler : function() {}用parent.$.modalDialog.handler.find('#id') 获取不到a子窗口的任何属性。
请问该怎样修改?
比如: 父窗口弹出A子窗口
parent.$.modalDialog({
title : '添加客户资料信息',
width : 750,
height : 380,
href : '${pageContext.request.contextPath}/customerController/addPage',
buttons : [ {
text : '添加',
handler : function() {
parent.$.modalDialog.openner_dataGrid = dataGrid;//因为添加成功之后,需要刷新这个dataGrid,所以先预定义好
var f = parent.$.modalDialog.handler.find('#form');//---------问题在此处,获取不到A窗口中任何属性值
f.submit();
}
} ]
});
a子窗口弹出b子窗口:
parent.$.modalDialog({
title : '选择',
width : 450,
height : 390,
href : '${pageContext.request.contextPath}/careerController/manager',
buttons : [ {
text : '选择',
handler : function() {
var f = parent.$.modalDialog.handler.find('#selectRadio:checked');
var row = dataGrid.datagrid('getSelected');
//alert($('#selectRadio:checked').val());
if (row) {
$('#careerkindname').val(row.careerkindname);
$('#careerkindno').val($(f.val()));
}
parent.$.modalDialog.handler.dialog('close');
}
} ]
});