0
votes

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 %}
            ]
        });
1

1 Answers

0
votes

As of version 2.1.1, jQueryUI is no longer a dependency (see release notes).

As the method signature kept the same, you will see in the source code that it always passes an empty object:

//(... fullCalendar 2.1.1 source code ...)
// line 4544
dragStart: function(ev) {
    _this.triggerSegMouseout(seg, ev); // ensure a mouseout on the manipulated event has been reported
    _this.isDraggingSeg = true;
    view.hideEvent(event); // hide all event segments. our mouseFollower will take over
    view.trigger('eventDragStart', el[0], event, ev, {}); // last argument is jqui dummy
},

When the eventDragStart is triggered the last argument is jqui dummy