logo

FullCalendar

eventAllow 3.0

Exact programmatic control over where an event can be dropped.

function(dropInfo, draggedEvent)

After it has been determined that the eventOverlap and eventConstraint settings will allow the user to drop an event at a given position on the calendar, the eventAllow callback will be called. It will be called for every new potential droppable position as the user is dragging.

If specified, it must return either true or false as to whether the calendar will allow the given event (draggedEvent) to be dropped at the given location (dropInfo).

eventAllow: function(dropLocation, draggedEvent) {
  if (draggedEvent.id === '999') {
    return dropLocation.start.isAfter('2016-01-01'); // a boolean
  }
  else {
    return true;
  }
}

The dropLocation object will have the following properties:

Resources

In addition to receiving information about which date the user is attempting to drop the event upon, it will also receive information about the resource:

eventAllow: function(dropLocation, draggedEvent) {
  if (draggedEvent.id === '999') {
    return String(dropLocation.resourceId).indexOf('a') >= 0; // boolean
  }
  else {
    return true;
  }
}

Only available with the Scheduler plugin.