DayPilot.Scheduler.registerDropTarget

The registerDropTarget() method registers an external element, typically a list of unscheduled events, as a drop target for Scheduler events dragged out of a DayPilot.Scheduler instance with dragOutAllowed set to true.

This is a static method. Call it using the full prefix, not on a DayPilot.Scheduler instance.

Available since 2021.2.4931.

Declaration

DayPilot.Scheduler.registerDropTarget(options)

Parameters

  • options.element (DOM element) - DOM node activated as the external drop target

  • options.onDragEnter - event handler fired when the dragged event enters the target; available since 2025.4.6742

  • options.onDragLeave - event handler fired when the dragged event leaves the target; optional

  • options.onDragOver - event handler fired continuously while the dragged event is over the target; optional

  • options.onDrop - event handler fired when the dragged event is dropped on the target; optional

The event handlers receive an args object with the following property:

Example

DayPilot.Scheduler.registerDropTarget({
  element: document.getElementById("queue"),
  onDrop: (args) => {
    const parent = document.getElementById("external");
    const li = document.createElement("li");
    li.setAttribute("data-duration", args.e.duration().totalHours());
    li.setAttribute("data-id", args.e.id());
    li.style.cursor = "move";
    li.innerText = args.e.text();
    parent.appendChild(li);

    makeDraggable();

    dp.events.remove(args.e);
  },
});

See Also

DayPilot.Scheduler.dragOutAllowed

DayPilot.Scheduler.makeDraggable()

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript