私のアプリケーションには、非常にうまく機能するモーダル ダイアログが 1 つあります。以下の関数でダイアログのセットアップとオープンを行います
$(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');
}
});
}
問題は、2 番目のダイアログがまったく開かないことです。Chrome 開発者ツールで確認したところ、div には ajax 呼び出しから受け取った適切な HTML が含まれていますが、スタイル プロパティに「display: none」がまだ含まれていることがわかります。
私はどこで間違っていますか?
アップデート:
これらは、使用される 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>
2回目の更新: