Skip to main content

selected

Description

Optional. An array with IDs of the tasks which need to be selected on initialization of To Do List

Usage

selected?: (string | number)[];

Example

const { ToDo, Toolbar } = todo;

// create To do list
const list = new ToDo("#root", {
tasks: [
{ id: "1", text: "Task 1 #tag1" },
{ id: "1.1", text: "Task 1.1", parent: "1" },
{ id: "1.1.1", text: "Task 1.1.1", parent: "1.1" },
{ id: "1.2", text: "Task 1.2", parent: "1" },
],
selected: ["1.1"]
});

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

Change log: Added in v1.1

Related article: Multiple select and bulk operations