Skip to main content

setProject()

Description

Sets the specified project as an active one

Usage

setProject({
id: string | number | null
}): void;

Parameters

  • id - (required) the ID of a project. To display the No project section, set ID to null

Example

const { ToDo, Toolbar } = todo;

const list = new ToDo("#root", {
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
],
activeProject: "second"
});

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

// change an active project
list.setProject({
id: "first"
});

Related article: Operations with projects