1
votes

I would like to add an event to the fullcalendar jquery plugin from an external source. I need the event title; start and end dates. I read that the drop callback function is called when you drop an external source on the calendar. This reports the start date in the alert. The eventReceive option shows the title of the event. This alert is displayed after the drop callback. This is the code:

$('#edit_calendar').fullCalendar({
...
 droppable: true,
 drop: function(date) {
        alert("Dropped on " + date );
 },
eventReceive: function (event) {
         alert('event, ' + event.title + ', was added, (need date here)');
 },

How do I get the start date value from the drop callback to the eventRecieve function?

1

1 Answers

1
votes

You can get the start and end dates within the drop event. This is the code I added to the drop event:

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);
},