我在对话框中打开我的编辑表单。但是当首先单击编辑按钮时,它会在提交和取消按钮以及大约3秒后加载内容时加载空的bo。如何加载微调器直到内容在对话框内完全加载?
mycode的
$("#userTable").on("click", " .edit-page .myHref", function () {
var $this = $(this);
var $link = ($this.attr('href'));
opendialog($link);
return false;
});
function opendialog($link) {
var $dialog = $('<div id="dialog_edit"></div>')
.load($link + ' #content_edit')
.dialog({
width: 535,
resizable: false,
modal: true,
position: ['center', 100],
show: {effect: 'fade', duration: 500},
autoOpen: false,
title: "Edit User",
buttons: [
{
text: "Update",
type: "submit",
"class": 'updateButtonClass',
click: function () {
$('.updateButtonClass').submit();
toggleSpinner();
}
},
{
text: "Cancel",
"class": 'saveButtonClass',
click: function () {
$(this).dialog("close");
}
}
],
});
$dialog.ajaxSuccess(function () {
$("#edit_user select").chosen({
disable_search: true,
width: "100%"
});
// setTimeout(function(){
//date-pickers-- Start
var validCurDate = $('.valid_to').val();
var activationCurDate = $('.activation_on').val();
// alert(validCurDate);
$(".valid_to").datepicker({
firstDay: 1,
dateFormat: "yy-mm-dd",
minDate: activationCurDate,
onSelect: function (selected) {
$('.activation_on').datepicker('option', 'maxDate', selected);
}
});
$(".activation_on").datepicker({
firstDay: 1,
dateFormat: "yy-mm-dd",
maxDate: validCurDate,
onSelect: function (selected) {
$('.valid_to').datepicker('option', 'minDate', selected);
}
});
// Clear datepicker Max/Min-Date the field if empty
$('.valid_to').change(function () {
$(".activation_on").datepicker('option', 'maxDate', null);
});
$('.activation_on').change(function () {
$(".valid_to").datepicker('option', 'minDate', null);
});
})
$dialog.dialog('open');