Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
67
rated 0 times [  69] [ 2]  / answers: 1 / hits: 38401  / 11 Years ago, thu, october 17, 2013, 12:00:00

I'm using Fullcalendar for a project I'm developing ... I have only one feature left to be implemented, which is when an existing event is dragged from it's original position to another time or date. I would like to know how I get the current object information (title, new start time, old start time, id, url, etc), so I can update the database with the newer information ... which property from the Fullcalendar object do I use?
I implemented the drop property;



    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();
}
},


but it's not doing what I wanted ...


More From » jquery

 Answers
109

Take a look at the Event Dragging and Resizing http://arshaw.com/fullcalendar/docs/event_ui/



I think what you are looking for the eventDrop callback.




Triggered when dragging stops and the event has moved to a different
day/time.




http://arshaw.com/fullcalendar/docs/event_ui/eventDrop/



Example from arshaw's site:



$('#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();
}

}
});

[#74916] Wednesday, October 16, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jalyn

Total Points: 173
Total Questions: 96
Total Answers: 90

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;