Skip to main content

schedule-tasks

PRO

The functionality is available in PRO Edition only

Description​

Triggers cascading updates of tasks in auto scheduling mode
info

The action works only if auto scheduling is enabled.

The schedule-tasks action triggers recalculation of tasks according to auto scheduling rules. It updates all dependent tasks based on their 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?: Partial<ITask>,
link?: string | number,
}) => boolean | void;

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) an object with the task values to apply to the triggering task; only start and duration are taken into account. If not set, the current values of the task are used
  • link - (optional) the ID of the link that triggered auto-scheduling. Gantt sets this automatically when a link operation (add or update) causes rescheduling

Example​

import { useState } 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, setApi] = useState(null);

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

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

Related articles: