Skip to main content

api.getResourceTasks(id)

PRO

The functionality is available in PRO Edition only

Description

Gets all tasks assigned to a resource

Usage

api.getResourceTasks(id): ITask[];

Parameters

  • id - the id of the resource

Returns

The method returns an array of tasks assigned to the specified resource. Returns an empty array if no tasks are assigned.

Example

<script>
import { getData } from "../data";
import { Gantt } from "@svar-ui/svelte-gantt";

const data = getData();

function init(api) {
const tasks = api.getResourceTasks("r1");
console.log("Assigned tasks:", tasks);
}
</script>

<Gantt
tasks={data.tasks}
links={data.links}
scales={data.scales}
resources={data.resources}
assignments={data.assignments}
{init}
/>

Related articles: