I set up a fullcalendar with a eventStartDrag. When I do a log of the UI variable in the event, it seems to be empty. Is there any reason why ? All the other variables that are passed are ok.
var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function (date) { // this function is called when something is dropped
// 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 to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
$('#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();
}
},
eventResize: function (event, delta, revertFunc) {
event.isChanged = true;
},
eventDrop: function (event, delta, revertFunc) {
event.isChanged = true;
},
eventDragStart: function (event, jsEvent, ui, view) {
console.log(event);
console.log(jsEvent);
console.log(ui);
console.log(view);
var dragged = [ui.helper[0], event];
},
events: [
{% for timeEntry in timeEntries %}
{
id: {{ timeEntry.id }},
title: '{{ timeEntry.task.description }}',
taskId: '{{ timeEntry.task.id }}',
start: '{{ timeEntry.startTime|date("Y-m-d\\TH:i:s") }}',
{% if timeEntry.stopTime is not null %}
end: '{{ timeEntry.stopTime|date("Y-m-d\\TH:i:s") }}',
{% else %}
end: null,
{% endif %}
isNew: false,
isChanged: false
},
{% endfor %}
]
});