I have a quick question about fullcalendars drag and drop functionality.
Here is my JS Code
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
right: 'title'
},
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
console.log(originalEventObject.title);
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
// console.log(originalEventObject.start);
// console.log(originalEventObject.end);
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
// is the "remove after drop" checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}
}
});
I would like to create a new variable called var dragged_event that looks something like below with each dragged and dropped event.
var dragged_event = "Name: " + originalEventObject.title + ", Start: " + ??? + ", End: " + ???
So the output look like something similar
console.log(dragged_event);
//Name: Birthday Start: Mar 06 2014 End: Mar 08 2014
Currently I'm unable to determined how to get the Start and End date of the dragged event. Could anyone lend me a hand in solving this please?
Thank you for reading.