我搜索了Stackoverflow来回答我的问题:如何将丢弃的外部事件立即保存到数据库中。通过对话框添加和更新事件工作正常。拖动的外部事件可以很好地呈现。这是我在eventReceive函数中使用的代码。显示事件数据的第一个警报是正确的,但是从未到达第二个警报。
eventReceive: function (event, delta, revertFunc) {
alert(event.title + " was dropped on " + event.start.format()); //REPLACE WITH AJAX TO SAVE EVENT DATA
var eventToAdd = {
title: event.title,
description: "Unknown",
start: event.start.format,
end: event.end.format,
allDay: isAllDay(event.StartDate, event.EndDate)
};
if (checkForSpecialChars(eventToAdd.title) || checkForSpecialChars(eventToAdd.description)) {
alert("please enter characters: A to Z, a to z, 0 to 9, spaces");
}
else {
alert(event.title + " was dropped on " + event.start.format());
PageMethods.addEvent(eventToAdd, addSuccess);
}
},
我深入挖掘,据我所知,在var eventToAdd之后,当鼠标悬停在页面中的任何元素上时,JQuery 3.3.1会一遍又一遍地触发相同的函数。涉及的函数有:matchFromGroupMatchers,elementmatcher,prefilter和Sizzle。 fullcalendar的javascript不会恢复。
似乎变量eventToAdd正在使用中。将其更改为其他名称解决了它。我现在这样:
eventReceive: function (event) {
// alert(event.title + " was dropped on " + event.start.format());
var eventAdd = {
start: event.start.format(),
end: event.end.format(),
title: event.title,
description: "Onbekend",
hwType: "Proefwerk",
};
PageMethods.addEvent(eventAdd, addSuccess);
},