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 thedataproperty of the active area that was used as the drag handleargs.control(DayPilot.Scheduler) - control instanceargs.async(boolean) - enables asynchronous processing of the default actionargs.e(DayPilot.Event) - object being movedargs.loaded()- continues processing whenargs.asyncis enabledargs.multimove- array of events being moved during multi-moving together with their new positions(Pro only in JavaScript Lite)args.newStart(DayPilot.Date) - target startargs.newEnd(DayPilot.Date) - target endargs.newResource(string | number) - target resource IDargs.external(boolean) -truewhen the move comes from an external source(Pro only in JavaScript Lite)args.alt(boolean) - Alt key pressed statusargs.ctrl(boolean) - Ctrl key pressed statusargs.shift(boolean) - Shift key pressed statusargs.meta(boolean) - Meta key pressed statusargs.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:
event(DayPilot.Event) - source objectstart(DayPilot.Date) - new startend(DayPilot.Date) - new endresource(string | number) - new resourceoverlapping(boolean) - overlap status (read-only)
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
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
Lite args missing: external, multimove, position
DayPilot