DayPilot.Month.onEventMove

The onEventMove event handler is called by the monthly calendar after the user drops an event at the target location (during drag and drop event moving).

This event is called before the default action set using eventMoveHandling. You can use args.preventDefault() to prevent the default action.

See also onEventMoved event which is called after the default action.

Declaration

DayPilot.Month.onEventMove(args)

Parameters

  • args.e (DayPilot.Event) - the event being moved

  • args.newStart (DayPilot.Date) - the new event start

  • args.newEnd (DayPilot.Date) - the new event end

  • args.ctrl (boolean) - state of the `Ctrl` key on drop

  • args.meta (boolean) - state of the `Meta` key on drop (available since 2023.3.5604)

  • args.shift (boolean) - state of hte `Shift` key on drop

  • args.position (number) - target vertical position of the event within a cell (in the cell stacking mode)

  • args.preventDefault() - cancels the default action

Example

onEventMove: (args) => {
  if (args.newStart > DayPilot.Date.today()) {
    args.preventDefault();
    dp.message("Moving events to the future not allowed");
  }
};

api=1

In api=1 mode this event is only called if eventMoveHandling is set to "JavaScript".

Declaration

onEventMove(e, newStart, newEnd, ctrl, shift, position)

Parameters

  • e (DayPilot.Event) - the event reference

  • newStart (DayPilot.Date) - new event start

  • newEnd (DayPilot.Date) - new event end

  • ctrl (boolean) - true if control key was pressed on drop

  • shift (boolean) - true if shift key was pressed on drop

  • position (int) - position inside a day when .moveToPosition is enabled