Skip to main content

drag

Description

Fires when the user is dragging the tasks

Usage

"drag":({
start: string | number,
source: (string | number)[],
target: string | number | null
}) => void;

Parameters

The callback of the drag event can take an object with the following parameters:

  • start - (required) the ID of the task from which the dragging process has started
  • source - (required) an array with IDs of dragged tasks
  • target - (required) the ID of a potential target task
info

To handle the inner events, you can use the Event Bus methods

Example

const { ToDo, Toolbar } = todo;
const {tasks, projects, users} = getData();

const list = new ToDo("#root", {
tasks,
projects,
users
});

const toolbar = new Toolbar("#toolbar", {
api: list.api,
});

// subscribe to the "drag" event
list.api.on("drag", ({start, source, target}) => {
console.log(start, source, target);
});

Change log: Added in v1.1

Related article: Drag-n-drop