[英]Problems with appear confirm window when closing dialog?
When I add the card to the in box. 当我将卡片添加到收件箱中时。 Then it is possible to double click on the card, and dialog pop up.
然后可以双击该卡,然后弹出对话框。 In the dialog I have Tow buttons (Save) and (Cancel).
在对话框中,有“拖曳”按钮(“保存”和“取消”)。 When I press Cancel buttons a confirm window pop-ups.
当我按“取消”按钮时,将弹出一个确认窗口。
I want when I press the close in the right corner, that confirm window pop-ups. 我想要当我按下右上角的关闭按钮时,确认弹出窗口。 I tried by this part of code to fix it, but not succeeded:
我尝试通过这部分代码对其进行修复,但未成功:
close: function () {
$('#dialog-confirm').dialog({
resizable: false,
height: 300,
modal: true,
draggable: false,
buttons: {
YES: function () {
$(this).dialog("close");
$('#modalDialog').dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
The issue is when I'm doing it in that way, the dialog window first close, then the confirm window pop-up. 问题是当我以这种方式执行操作时,首先关闭对话框窗口,然后弹出确认窗口。 I don't want that, but I want the opposite.
我不想要那个,但我要相反。
JQuery: JQuery的:
$(function () {
// Click function to add a card
var $div = $('<div />').addClass('sortable-div');
$('<label>Title</label><br/>').appendTo($div);
$('<input/>', { "type": "text","class":"ctb"}).appendTo($div);
$('<input/>', { "type": "text","class":"date"}).appendTo($div);
var cnt =0,$currentTarget;
$('#AddCardBtn').click(function () {
var $newDiv = $div.clone(true);
cnt++;
$newDiv.prop("id","div"+cnt);
$('#userAddedCard').append($newDiv);
// alert($('#userAddedCard').find("div.sortable-div").length);
});
// Double click to open Modal Dialog Window
$('#userAddedCard').dblclick(function (e) {
$currentTarget = $(e.target);
$('#modalDialog').dialog({
modal: true,
height: 600,
width: 500,
position: 'center',
buttons: {
Save: function () { //submit
var val = $("#customTextBox").val();
$currentTarget.find(".ctb").val(val);
$currentTarget.find(".date").val($("#datepicker").val());
$('#modalDialog').dialog("close");
},
Cancel: function () { //cancel
$('#dialog-confirm').dialog({
resizable: false,
height: 300,
modal: true,
draggable: false,
buttons: {
YES: function () {
$(this).dialog("close");
$('#modalDialog').dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
},
close: function () {
$('#dialog-confirm').dialog({
resizable: false,
height: 300,
modal: true,
draggable: false,
buttons: {
YES: function () {
$(this).dialog("close");
$('#modalDialog').dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
});
});
$("#datepicker").datepicker({showWeek:true, firstDay:1});
});
Maybe I'm wrong, in that way I'm doing. 也许我做错了,那样做。 Any idea how to fix it?
知道如何解决吗?
您可以尝试将beforeClose用于确认窗口,如果确认,则关闭对话框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.