DayPilot.Scheduler.makeDraggableAsRow

The makeDraggableAsRow() method allows activating external items so they can be dragged as rows to the JavaScript Scheduler component.

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.makeDraggableAsRow(options);

Parameters

  • options.data - the source data object

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

  • options.remove (DOM element) - the element to be removed on drop; if not specified, options.element will be used

  • options.keepElement (boolean) - set to true if the original element should not be removed from DOM on drop; optional

The source data object (options.data) requires the following properties:

  • id (string | number) - resource ID

  • name (string) - resource name

Example

<div id="item" data-id="1">Draggable item</div>

<script>
  const e = document.getElementById("item");

  const item = {
    element: e,
    data: {
      id: e.getAttribute("data-id"),
      name: e.innerText,
    }
  };
  DayPilot.Scheduler.makeDraggableAsRow(item);
</script>