DayPilot.Scheduler.onEventMove

The onEventMove event handler fires after the user finishes event moving (on drop) but before the default action configured by DayPilot.Scheduler.eventMoveHandling is performed.

Use DayPilot.Scheduler.onEventMoved when you need a callback after the default action completes.

Declaration

DayPilot.Scheduler.onEventMove(args)

Parameters

  • args.areaData - value of the data property of the active area that was used as the drag handle

  • args.control (DayPilot.Scheduler) - control instance

  • args.async (boolean) - enables asynchronous processing of the default action

  • args.e (DayPilot.Event) - object being moved

  • args.loaded() - continues processing when args.async is enabled

  • args.multimove - array of events being moved during multi-moving together with their new positions (Pro only in JavaScript Lite)

  • args.newStart (DayPilot.Date) - target start

  • args.newEnd (DayPilot.Date) - target end

  • args.newResource (string | number) - target resource ID

  • args.external (boolean) - true when the move comes from an external source (Pro only in JavaScript Lite)

  • args.ctrl (boolean) - Ctrl key pressed status

  • args.shift (boolean) - Shift key pressed status

  • args.meta (boolean) - Meta key pressed status

  • args.position (number) - target position index when event position mode is enabled (Pro only in JavaScript Lite)

  • args.preventDefault() - cancels the default action

Notes

Call args.preventDefault() to reject the move synchronously. For asynchronous validation, set args.async = true, perform the custom check, and call args.loaded() when the operation is finished.

The args.multimove array includes the main event as well (args.e). Each item has the following structure:

In api=1 mode, the legacy signature is onEventMove(e, newStart, newEnd, newResource, external, ctrl, shift). In that mode, this event is only called when DayPilot.Scheduler.eventMoveHandling is set to "JavaScript".

Examples

JavaScript

const dp = new DayPilot.Scheduler("dp", {
  onEventMove: (args) => {
    if (args.external) {
      args.preventDefault();
      args.control.message("External drop forbidden");
    }
  },
  // ...
});
dp.init();

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
  onEventMove: (args) => {
    if (args.external) {
      args.preventDefault();
      args.control.message("External drop forbidden");
    }
  },
  // ...
};

React

<DayPilotScheduler
  onEventMove={onEventMove}
  {/* ... */}
/>
const onEventMove = (args) => {
  if (args.external) {
    args.preventDefault();
    args.control.message("External drop forbidden");
  }
};

Vue

<DayPilotScheduler
  @eventMove="onEventMove"
  <!-- ... -->
/>
const onEventMove = (args) => {
  if (args.external) {
    args.preventDefault();
    args.control.message("External drop forbidden");
  }
};

See Also

Event Moving [doc.daypilot.org]

DayPilot.Scheduler.onEventMoving

DayPilot.Scheduler.onEventMoved

DayPilot.Scheduler.eventMoveHandling

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript

Lite args missing: external, multimove, position