我用eventStartDrag设置了一个完整的日历。当我对事件中的UI变量进行日志记录时,它似乎是空的。有什么原因吗?传递的所有其他变量都可以。
var 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 %}
]
});
从2.1.1版本开始,jQueryUI不再是依赖项(请参阅发行说明)。
由于方法签名保持不变,您将在源代码中看到它总是传递一个空对象:
//(... 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
},
当eventDragStart
被触发时,最后一个参数是jqui dummy