DayPilot.Scheduler.onRowMove

The onRowMove event handler is called by the JavaScript Scheduler after the user finishes drag-and-drop row moving, before the default action configured by rowMoveHandling.

Declaration

DayPilot.Scheduler.onRowMove(args)

Parameters

  • args.external (boolean) - indicates that the row was dragged from an external source such as a custom draggable item or another Scheduler instance

  • args.source (DayPilot.Row) - the dragged row

  • args.target (DayPilot.Row) - the target row

  • args.position ("child" | "before" | "after" | "forbidden") - drop position relative to the target row

  • args.keepSource() - keeps the row in the source Scheduler as well when it is moved from another Scheduler instance

  • args.preventDefault() - prevents the default action

Notes

The event is raised before the default action configured by rowMoveHandling. Call args.preventDefault() to cancel the built-in move handling, or args.keepSource() to keep the source row when accepting a row moved from another Scheduler.

Values of args.position:

  • "child" - drop the row as a child of the target row

  • "before" - insert the row before the target row

  • "after" - insert the row after the target row

  • "forbidden" - the current drop target is not allowed

Examples

JavaScript

const dp = new DayPilot.Scheduler("dp", {
  onRowMove: (args) => {
    if (args.position === "forbidden") {
      args.preventDefault();
      return;
    }
    if (args.external) {
      args.keepSource();
    }
  },
  // ...
});
dp.init();

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
  onRowMove: (args) => {
    if (args.position === "forbidden") {
      args.preventDefault();
      return;
    }
    if (args.external) {
      args.keepSource();
    }
  },
  // ...
};

React

<DayPilotScheduler
  onRowMove={onRowMove}
  {/* ... */}
/>
const onRowMove = (args) => {
  if (args.position === "forbidden") {
    args.preventDefault();
    return;
  }
  if (args.external) {
    args.keepSource();
  }
};

Vue

<DayPilotScheduler
  @rowMove="onRowMove"
  <!-- ... -->
/>
const onRowMove = (args) => {
  if (args.position === "forbidden") {
    args.preventDefault();
    return;
  }
  if (args.external) {
    args.keepSource();
  }
};

See Also

Row Moving [doc.daypilot.org]

External Drag and Drop of Rows [doc.daypilot.org]

Row Moving Between Schedulers [doc.daypilot.org]

DayPilot.Scheduler.rowMoveHandling

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript