ユーザーがダイアログを開くと、処理する必要がある多数の ajax リクエストがあるため、ロード情報を表示するだけの 2 番目のダイアログがあり、すべてのリクエストが処理されると閉じます。
ユーザーが開いたダイアログを一度開いたら、Escape キーで閉じることができません。エスケープを使用する前に、ダイアログ自体をクリックする必要があります。
ロードダイアログが閉じた後にユーザーが開いたダイアログにフォーカスを割り当てるために次のことを試みましたが、役に立ちませんでした。エスケープキーで閉じる前にダイアログをクリックする必要があります。
$(document).ajaxStart(function () {
// IF loading dialog is not allready being shown show it.
if ($("#LoadingData").dialog('isOpen') === false) {
$("#LoadingData").dialog('open');
}
});
$(document).ajaxStop(function () {
//Close the loading dialog once the requests have finished
$("#LoadingData").dialog('close');
//Find the user opened dialog
$('.cmdialog').each(function () {
if ($(this).dialog('isOpen')) {
$(this).trigger('click');//set focus to dialog
// have also replaced .trigger('click') with .focus() but to no avail
}
}).on('click', function() {
//if click is triggerd set the focus of the dialog.
if ($(this).prop('id') != 'LoadingData') {
$(this).focus();
}
});
});
ダイアログ内の最初の要素にフォーカスを設定しようとしまし$('#DialogName:first-child').focus()
た$('#DialogName:first-child').trigger('click')
が、これも機能しません。
フォーカスが設定されていない理由について何か考えはありますか? .focus()
または、 andを誤解/誤って使用してい.trigger('event')
ますか?
ありがとう :)