Skip to main content

api.getResourceTasks(id)

The functionality is available in PRO Edition only

PRO

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

import { getData } from "../data";
import { Gantt } from "@svar-ui/react-gantt";

const data = getData();

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

export default function App() {
return (
<Gantt
tasks={data.tasks}
links={data.links}
scales={data.scales}
resources={data.resources}
assignments={data.assignments}
init={init}
/>
);
}

Related articles: