我想从外部源向fullcalendar jquery插件添加一个事件。我需要活动名称;开始日期和结束日期。我读到drop
回调函数是在您将外部源放到日历上时调用的。这将报告警报中的开始日期。eventReceive
选项显示事件的标题。此警报在drop
回调之后显示。这是代码:
$('#edit_calendar').fullCalendar({
...
droppable: true,
drop: function(date) {
alert("Dropped on " + date );
},
eventReceive: function (event) {
alert('event, ' + event.title + ', was added, (need date here)');
},
如何从drop
回调到eventRecieve
函数获得开始日期值?
您可以在drop
事件中获取开始和结束日期。这是我添加到drop
事件的代码:
drop: function (date, jsEvent, ui, resourceId) {
var memberName = $(this).data('event').title;
var memberID = $(this).attr('id').toString();
//Create Event - add to array
var newEvent = new Object();
newEvent = {
title: memberName,
id: memberID,
start: date.format(),
end: date.format(),
objectID: 0
};
eventsAdded.push(newEvent);
},