ボタンをクリックすると開くモーダル ダイアログがあり、開くと.xhtml
page が読み込まれます。
この XHTML ページ内には、親ウィンドウ (ダイアログが初期化される場所) にデータを戻すためのボタンがあり、その後、ダイアログを閉じたいのですが、閉じません!! これは私のコードです:
先頭ページ:
<script type="text/javascript">
var selected_row_data_json;
window.lang = new jquery_lang_js();
$().ready(function () {
$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});
createDataListDialog();
});
function setSelectedRowJsonData(row_data_)
{
selected_row_data_json = row_data_;
}
function setFormSelectedValues()
{
$('#dataListDialog').dialog('close');
}
function createDataListDialog()
{
$("#dataListDialog").dialog(
{
autoOpen: false,
modal: true,
resizable: true,
open: function (event, ui) {
/* <![CDATA[ */
$('#dataListDialog').css('overflow', 'hidden');
$('body').css('overflow','hidden');
$(this).load("data_list.xhtml");
/* ]]> */
},
height: 400,
width: 550,
close: function (event, ui) {
$(this).dialog('destroy');
createDataListDialog();
},
create: function(event, ui)
{
$(this).parents(".ui-dialog").css("padding", 0);
$(this).parents(".ui-dialog:first")
.find(".ui-dialog-content").css("padding", 0);
}
});
}
</script>
<f:view>
<h:outputLabel value="Code:" lang="en" onclick="openDialog('dataListDialog');return false;" />
<div id="dataListDialog" lang="en" title="Users" dir="#{user.dir}">
</div>
</f:view>
data_list.xhtml
ページ:
<script type="text/javascript">
function test()
{
window.parent.setSelectedRowJsonData(selected_row_data_json);
window.parent.setFormSelectedValues();
}
</script>
<h:form id="dataListForm" ">
<input type="button" onclick="test()" value="TEST">/input>
</h:form>
私は何か間違ったことをしていますか?何か足りない?読み込まれたページからダイアログが閉じられないのはなぜですか?
更新: ロードされたページがページである場合、html
それはうまく機能します - ダイアログは閉じています。問題は、ページがxhtml
ページの場合です..どうすればこれを修正できますか?
どんな助けでも大歓迎です!