Skip to main content

move-task

Description

Fires when moving a task

Usage

"move-task": ({
id: string | number,
parent?: string | number | null,
project?: string | number | null,
targetId?: string | number,
reverse?: boolean
}) => void;

Parameters

The callback of the move-task event can take an object with the following parameters:

  • id - (required) the ID of the moved task
  • parent - (optional) the ID of the parent task
  • project - (optional) the ID of the project
  • targetId - (optional) the ID of the target task
  • reverse - (optional) true, if the task is pasted before the target task; otherwise, false
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 "move-task" event
list.api.on("move-task", ({id}) => {
console.log("The", id, "task is moved");
});

Related article: Operations with tasks