Search code examples
javascripthtmlfullcalendarfullcalendar-3

Dragging more information into an existing event


I am looking to FullCalendar for a full shift/rota system in our application. I have been able to copy external events in to the calendar which has worked great, however I would like to be able to drag in more information into that specific event.

Say I have a shift from 08:00 to 16:00, I will drag that shift into the FullCalendar control. I would then like to be able to assign staff to that event. So dragging a staff member into that event will then update the database and re-render the calendar with a bigger description and with that staff member as a value in extendedProps.

Does anyone know if this is possible at all?


Solution

  • I have managed to get this working using jQuery draggable. So firstly I told fullcalendar to only accept internal drag events from a specific class (so I can drag in time slots into the calendar):

    dropAccept: ".PresetShift"

    And then on eventRender, I make the event droppable (so I can drop in the crew members/staff members):

       $(element).droppable({
            scope: "staff",
            hoverClass: "highlighted",
            drop: function(dropEvent, ui) {
                //Get data from event, attributes from the dropped in staff member, and the 
                event and use a page method to save/update the data. 
                Then update the fullcalendar event
            }
        });
    },