我的应用程序中有一个模式对话框,效果非常好。我使用以下功能设置并打开对话框
$(document).ready(function () {
$("#__gsl_DialogPanel").dialog({
autoOpen: false,
resizable: false,
position: 'center',
stack: true,
height: 'auto',
width: 'auto',
modal: true
});
});
function loadDialog(action, id, title, onCloseHandler) {
$("#__gsl_DialogPanel").dialog("option", "title", title);
var url = action;
if (id != "") url = url + "/" + id;
$.ajax({
type: "get",
dataType: "html",
url: url,
data: {},
success: function(response) {
$("#__gsl_DialogPanel").html('').html(response).dialog('open');
}
});
}
现在我需要从前一个对话框中的按钮打开另一个对话框。我创建了另一个 div(“__gsl_DialogPanel_2L”)并克隆了引用新对话框的 setup 和 open 函数,如下面的代码
$("__gsl_DialogPanel_2L").dialog({
autoOpen: false,
resizable: false,
position: 'center',
stack: true,
height: 'auto',
width: 'auto',
modal: true
});
function loadDialog2L(action, id, title, onCloseHandler) {
$("#__gsl_DialogPanel_2L").dialog("option", "title", title);
var url = action;
if (id != "") url = url + "/" + id;
$.ajax({
type: "get",
dataType: "html",
url: url,
data: {},
success: function (response) {
$("#__gsl_DialogPanel_2L").html('').html(response).dialog('open');
}
});
}
问题是第二个对话框根本没有打开。我检查了 Chrome 开发人员工具,我可以看到 div 包含从 ajax 调用接收到的正确 HTML,但其样式属性中仍有“显示:无”。
我在哪里做错了?
更新:
这些是使用的div。它们位于 BODY 标记之后的母版页中。
<!-- Generic Dialog Panel -->
<div id="__gsl_DialogPanel" style="display:none" title=""></div>
<!-- 2 Level Dialog Panel -->
<div id="__gsl_DialogPanel_2L" style="display:none" title=""></div>
第二次更新: