end-drag
Description
Fires when dragging of tasks has been finished
Usage
"end-drag":({
target: string | number | null,
dropPosition: "top" | "bottom" | "in" | null,
mode: "move" | "copy"
}) => void;
Parameters
The callback of the end-drag event can take an object with the following parameters:
target
- (required) the ID of the task from which the dragging process has starteddropPosition
- (required) the position where the dragged tasks has been dropped:top
- above the target taskbottom
- below the target taskin
- over the target task
mode
- (required) the mode of drag-n-drop:move
- the move modecopy
- the copy mode
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", ({ target, dropPosition, mode }) => {
console.log(target, dropPosition, mode);
});
Change log: Added in v1.1
Related article: Drag-n-drop