DayPilot.Scheduler.registerRowDropTarget

The registerRowDropTarget() method allows registering an external element as a drop target for JavaScript Scheduler rows. This will allow dragging rows from the Scheduler to this element.

This method is static. It has to be executed using the full prefix (not on a DayPilot.Scheduler class instance).

Available since 2024.4.6270.

Declaration

DayPilot.Scheduler.registerRowDropTarget(options);

Parameters

  • options.element (DOM element) - the element to be activated for drag and drop

  • options.onDragLeave - event handler that will be fired when the source event is moved outside of the target; optional

  • options.onDragOver - event handler that will be fired continuously when the source event is being moved over the target; optional

  • options.onDrop - event handler that will be fired on drop; optional

The event handlers will receive an args parameter with the following properties:

Example

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

        dp.rows.remove(args.row);
    },
});