跳到主要内容

Inactive Tasks and Links

Set active: false on a task or link to keep it in the project while excluding it from auto scheduling. Gantt applies an inactive style to the task row, bar or dependency line. Set active: true or omit the field to allow the item to participate.

Include active: false when you load or add the item. For an item already loaded, change its property and call the corresponding update method:

const task = gantt.getTask(taskId);
task.active = false;
gantt.updateTask(taskId);

const link = gantt.getLink(linkId);
link.active = false;
gantt.updateLink(linkId);

Use the update methods to synchronize the change with scheduling and rendering. If you save the project to a server, store active with the task or link data.

To change a dependency's activity from the timeline, use Activate link or Deactivate link in the built-in context menu.

How Gantt determines activity​

  • A task is inactive if its own active field or that of any ancestor is false. Deactivating a summary task leaves its descendants' stored flags intact.
  • A link is inactive if its own active field is false or either endpoint is inactive. In a chain A → B → C, deactivating B removes both dependencies from scheduling. Gantt does not create a dependency from A to C.

Use isTaskActive and isLinkActive to check the effective state:

const taskParticipates = gantt.isTaskActive(taskId);
const linkParticipates = gantt.isLinkActive(linkId);

Effects on the project​

  • Inactive tasks keep their dates. The scheduler skips them, and they do not drive their successors or appear on the critical path.
  • An active summary skips inactive children when deriving its dates and calculating subtask duration. It also skips them in rollup bars and split-task displays. An inactive summary still derives its span from its children.
  • In the built-in resource panel, inactive tasks do not contribute to resource load.

Customize the inactive style​

CSS variableAffects
--dhx-gantt-inactive-backgroundTask bar background
--dhx-gantt-inactive-colorTask bar text
--dhx-gantt-inactive-borderTask bar border, dashed by default
--dhx-gantt-inactive-opacityGrid row and link opacity

The matching CSS classes are gantt_task_inactive on the task bar, gantt_row_inactive on the grid row, gantt_task_row_inactive on the timeline row, and gantt_link_inactive on the link.

The samples/02_extensions/30_inactive_tasks.html example shows an Active checkbox in the grid, a link you can deactivate, and a complete inactive project branch.

Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.