[英]updating an event by dragging/dropping fullcalendar- Javascript
我正在為我正在開發的項目使用Fullcalendar ...我只剩下一個要實現的功能,即將現有事件從其原始位置拖動到另一個時間或日期。 我想知道如何獲取當前對象信息(標題,新開始時間,舊開始時間,id,url等),因此我可以使用更新的信息更新數據庫... Fullcalendar對象中的哪個屬性我用? 我實現了drop
屬性;
drop : function(date, allDay) {
// retrieve the dropped element's stored event object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't
// have a reference object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
// render the event on the calendar
// the last `true` argument determines if the event `sticks`
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
// if the 'remove after drop' checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so remove the element from the "Draggable Events"
$(this).remove();
}
},
但它沒有做我想要的......
看看事件拖動和調整大小http://arshaw.com/fullcalendar/docs/event_ui/
我想你正在尋找eventDrop回調。
拖動停止並且事件已移至不同的日期/時間時觸發。
http://arshaw.com/fullcalendar/docs/event_ui/eventDrop/
來自arshaw網站的示例:
$('#calendar').fullCalendar({
events: [
// events here
],
editable: true,
eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
alert(
event.title + " was moved " +
dayDelta + " days and " +
minuteDelta + " minutes."
);
if (allDay) {
alert("Event is now all-day");
}else{
alert("Event has a time-of-day");
}
if (!confirm("Are you sure about this change?")) {
revertFunc();
}
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.