easyui Dialog扩展建多个窗口问题

nixiangsileba 2013-07-30 08:10:25
我把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');
}
} ]
});
...全文
2213 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengjifei2008 2014-12-26
  • 打赏
  • 举报
回复
function treegridDeleteByIds(id,url) { var ids = []; if (id == undefined) {//点击右键菜单才会触发这个 var rows = dataGrid.datagrid('getSelections'); id = rows[0].ID; } parent.$.messager.confirm('请确认', '您要删除当前所选项目?', function(b) { if (b) { var rows = $('#dataGrid').datagrid('getChecked'); for ( var i = 0; i < rows.length; i++) { ids.push(rows[i].ID); } $.ajax({ url : basePath+url, data : { ids : ids.join(',') }, dataType : 'json', success : function(d) { $('#dataGrid').treegrid('load'); $('#dataGrid').treegrid('unselectAll'); parent.dj.messagerShow({ title : '提示', msg : d.msg }); } }); } }); }
黄二明 2014-08-14
  • 打赏
  • 举报
回复
问题解决了吗?求大神指教下,跪求跪求
a559927z 2014-03-14
  • 打赏
  • 举报
回复
我也和你遇到一样的问题
  • 打赏
  • 举报
回复
你的问题是?

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧