Skip to main content

Task assignees

You can delegate tasks to one or several people.

Configuring task assignees

The list of assignees is specified via the users configuration property of To Do List.

const users = [
{ id: "user_1", label: "Don Smith", avatar: "../avatar_61.jpg"},
{ id: "user_2", label: "Nadia Chasey", avatar: "../avatar_63.jpg" },
{ id: "user_3", label: "Mike Young", avatar: "../avatar_03.jpg" },
{ id: "user_4", label: "Elvira Webb", avatar: "../avatar_33.jpg" }
];

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

Setting assignees on initialization stage

To assign people to the necessary task on the initialization stage, pass the id(s) of the assignees to the assigned parameter of the related task object:

const users = [
{ id: "user_1", label: "Don Smith", avatar: "../avatar_61.jpg"},
...
];

const tasks = [
{
id: "2",
project: "introduction",
text: "You can assign task performers using the menu.",
assigned: [ "user_1", "user_2", "user_3", "user_4" ],
}
];

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

As a result, the assigned people will be displayed to the right of the task.

users

To view the list of people assigned to a task, click on the people avatars. To close the opened list, click outside it.

Changing task assignees

You can re-assign or remove a task assignee after initialization of To Do List in the following ways:

// assign a person to the task
list.assignUser({
id: "3",
userId: "user_1"
});

// unassign a person from the task
list.unassignUser({
id: "2",
userId: "user_1"
});