问题
Currently I am using Javascript confirm box to ask whether the user wants to proceed or he wants to revert, but I need to warn the user using Bootstrap popup. User needs to say 'Proceed/Cancel' in popup.
I used bootstrap modal popup. but the 'drop' doesn't wait for user's choice. It executes the flow of code written inside 'eventDrop', before user clicks yes/no button of popup.
Current code snippet:
eventDrop: function(event, delta, revertFunc) {
if (!confirm("Are you sure to re-book the ticket?"))
revertFunc();
}
Kindly suggest.
回答1:
Sometimes in eventDrop
function if
not work if {
}
not given. So, please follow my code below::
eventDrop: function(event, delta, revertFunc) {
if (!confirm("Are you sure to re-book the ticket?")) {
revertFunc();
}
}
But it will be better to use a confirmbox or bootstap cofirm modal because if any user checks prevent this page from additional dialogs , from next time that alert box will not show.
Working url:: https://jsfiddle.net/rekdp2wt/
来源:https://stackoverflow.com/questions/43125196/show-a-bootstrap-popup-and-then-revert-the-eventdrop-in-fullcalendar-based-on-us