Skip to main content

schedule-tasks

The functionality is available in PRO Edition only

PRO

Description

Triggers cascading updates of tasks in auto scheduling mode

The schedule-tasks action triggers recalculation of all tasks according to auto scheduling rules. It updates all dependent tasks based on end-to-start links, considering lag and project start constraints. Normally, this action is called automatically when tasks change (start, end, duration, or links), but it can also be invoked manually.

Usage

"schedule-tasks": {
id?: string | number,
task?: ITask,
link?: string | number,
};

Parameters

  • id - (optional) the ID of the task that triggered rescheduling. Pass 0 to recalculate the entire project; pass a specific task ID to start the cascade from that task
  • task - (optional) a task object to apply to the triggering task
  • link - (optional) the ID of the link that triggered auto-scheduling. Gantt sets this automatically when a link operation (add, update, or delete) causes rescheduling

Example

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

const { tasks, links } = getData();

export default function Example() {
const api = useRef(null);

function runSchedule() {
api.current?.exec("schedule-tasks", { id: 0 });
}

return (
<>
<Button onClick={runSchedule}>Apply Auto Schedule</Button>
<Gantt ref={api} tasks={tasks} links={links} schedule={{ auto: true }} />
</>
);
}

Related articles: