Task Scheduling with Duration Units in Vue Gantt Chart
Duration units
Duration units define how task duration values are interpreted and calculated in the Gantt Chart. Duration units can be configured globally for the entire project or individually for each task.
In the Gantt Chart component, the tasks’ duration value can be measured by the following duration units:
- Day: Standard for general planning. Represents a single calendar or working day.
- Hour: For detailed task management. Useful for tasks measured in hours within a day.
- Minute: For short-duration tasks. Ideal for tasks requiring precise time tracking in minutes.
- Week: Represents a duration calculated using the configured daysPerWeek value. This is useful for tasks that span multiple days but are easier to express in weeks.
- Month: Represents a duration calculated using the configured daysPerMonth value. This is helpful for longer-duration tasks that are naturally measured in months.
In the Gantt Chart component, you can define the duration unit for whole project by using the durationUnit property. When you define a value for this property, the duration unit will be applied for all tasks that do not have duration unit value.
Each task in the project can be defined with different duration units and the duration unit of a task can be defined by the following ways:
- Using the taskFields.durationUnit property, you can map the duration unit of data source field.
- Defining the duration unit value along with duration field in the data source.
Mapping the duration unit field
The following code snippet explains mapping the data source field of the duration unit to the Gantt Chart component using the taskFields.durationUnit property.
<template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :splitterSettings = "splitterSettings"></ejs-gantt>
</div>
</template>
<script setup>
import { GanttComponent as EjsGantt } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
const data = editingData;
const height = '450px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
durationUnit:'DurationUnit',
child: 'subtasks'
};
const splitterSettings={
columnIndex:4
}
</script><template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :splitterSettings = "splitterSettings"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: editingData,
height:'450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
durationUnit:'DurationUnit',
child: 'subtasks'
},
splitterSettings:{
columnIndex:4
}
};
},
};
</script>NOTE
The default value of the durationUnit property isday.
Defining duration unit along with duration field
A duration unit for a task can be defined along with duration value, the following code snippet explains the duration unit for a task along with duration value.
<template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :splitterSettings = "splitterSettings"></ejs-gantt>
</div>
</template>
<script setup>
import { GanttComponent as EjsGantt } from "@syncfusion/ej2-vue-gantt";
const data = [
{
TaskID: 1,
TaskName: 'Project Initiation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 2, TaskName: 'Identify Site location', StartDate: new Date('04/02/2019'), Duration: '3days', DurationUnit:'day', Progress: 50,isParent:false },
{ TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2019'), Duration: '12hours',DurationUnit:'hour', Progress: 70, resources: [2, 3, 5],isParent:false },
{ TaskID: 4, TaskName: 'Soil test approval', StartDate: new Date('04/02/2019'), Duration: '1800minutes',DurationUnit:'minute', Predecessor:"2FS", Progress: 80,isParent:false },
]
},
{
TaskID: 5,
TaskName: 'Project Estimation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 6, TaskName: 'Develop floor plan for estimation', StartDate: new Date('04/04/2019'), Duration: '12hours', DurationUnit:'hour', Progress: 50, resources: [4],isParent:false },
{ TaskID: 7, TaskName: 'List materials', StartDate: new Date('04/04/2019'), Duration: '3days', Progress: 50, DurationUnit:'day', resources: [4, 8],isParent:false },
{ TaskID: 8, TaskName: 'Estimation approval', StartDate: new Date('04/04/2019'), Duration: '480minutes',Predecessor:"6SS", DurationUnit:'minute', Progress: 70, resources: [12, 5],isParent:false }
]
},
];
const height = '450px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
};
const splitterSettings={
columnIndex:4
}
</script><template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :splitterSettings = "splitterSettings"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent } from "@syncfusion/ej2-vue-gantt";
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: [
{
TaskID: 1,
TaskName: 'Project Initiation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 2, TaskName: 'Identify Site location', StartDate: new Date('04/02/2019'), Duration: '3days', DurationUnit:'day', Progress: 50,isParent:false },
{ TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2019'), Duration: '12hours',DurationUnit:'hour', Progress: 70, resources: [2, 3, 5],isParent:false },
{ TaskID: 4, TaskName: 'Soil test approval', StartDate: new Date('04/02/2019'), Duration: '1800minutes',DurationUnit:'minute', Predecessor:"2FS", Progress: 80,isParent:false },
]
},
{
TaskID: 5,
TaskName: 'Project Estimation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 6, TaskName: 'Develop floor plan for estimation', StartDate: new Date('04/04/2019'), Duration: '12hours', DurationUnit:'hour', Progress: 50, resources: [4],isParent:false },
{ TaskID: 7, TaskName: 'List materials', StartDate: new Date('04/04/2019'), Duration: '3days', Progress: 50, DurationUnit:'day', resources: [4, 8],isParent:false },
{ TaskID: 8, TaskName: 'Estimation approval', StartDate: new Date('04/04/2019'), Duration: '480minutes',Predecessor:"6SS", DurationUnit:'minute', Progress: 70, resources: [12, 5],isParent:false }
]
},
],
height:'450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
},
splitterSettings:{
columnIndex:4
}
};
},
};
</script>NOTE:
The edit type of the duration column in Gantt is string to edit the duration field along with duration units.
Configure days per week and month
The daysPerWeek property specifies how many working days constitute one week, directly impacting how week-based durations are calculated. For example, if daysPerWeek is 5, then 1 week equals 5 working days.
Similarly, the daysPerMonth property specifies how many working days constitute one month, affecting how month-based durations are converted to actual working days for scheduling calculations. For example, if daysPerMonth is 20, then 1 month equals 20 working days.
The following example configures daysPerWeek and daysPerMonth properties:
<template>
<div>
<div style="margin-bottom: 10px">
<label>Days Per Week: </label>
<input id="daysPerWeek" v-model.number="daysPerWeekInput" type="number" min="1" max="7" />
<label style="margin-left: 10px">Days Per Month: </label>
<input id="daysPerMonth" v-model.number="daysPerMonthInput" type="number" min="1" max="31" />
<button id="updateButton" style="margin-left: 10px" @click="updateProperties">Update</button>
</div>
<ejs-gantt ref="gantt" :dataSource="data" :height="height" :daysPerWeek="daysPerWeek" :daysPerMonth="daysPerMonth" :taskFields="taskFields" :splitterSettings="splitterSettings"></ejs-gantt>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { GanttComponent as EjsGantt } from "@syncfusion/ej2-vue-gantt";
import { GanttData } from './data-source.js';
const gantt = ref(null);
const data = GanttData;
const height = '380px';
const daysPerWeek = 5;
const daysPerMonth = 20;
const daysPerWeekInput = ref(5);
const daysPerMonthInput = ref(20);
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
durationUnit: 'DurationUnit',
parentID: 'ParentID'
};
const splitterSettings = { columnIndex: 4 };
const updateProperties = () => {
if (daysPerWeekInput.value < 1 || daysPerWeekInput.value > 7) {
alert('Days per Week must be between 1 and 7');
return;
}
if (daysPerMonthInput.value < 1 || daysPerMonthInput.value > 31) {
alert('Days per Month must be between 1 and 31');
return;
}
gantt.value.ej2Instances.daysPerWeek = daysPerWeekInput.value;
gantt.value.ej2Instances.daysPerMonth = daysPerMonthInput.value;
};
</script><template>
<div>
<div style="margin-bottom: 10px">
<label>Days Per Week: </label>
<input id="daysPerWeek" v-model.number="daysPerWeekInput" type="number" min="1" max="7" />
<label style="margin-left: 10px">Days Per Month: </label>
<input id="daysPerMonth" v-model.number="daysPerMonthInput" type="number" min="1" max="31" />
<button id="updateButton" style="margin-left: 10px" @click="updateProperties">Update</button>
</div>
<ejs-gantt ref="gantt" :dataSource="data" :height="height" :daysPerWeek="daysPerWeek" :daysPerMonth="daysPerMonth" :taskFields="taskFields" :splitterSettings="splitterSettings"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent } from "@syncfusion/ej2-vue-gantt";
import { GanttData } from './data-source.js';
export default {
name: "App",
components: { "ejs-gantt": GanttComponent },
data: function() {
return {
data: GanttData, height: '380px', daysPerWeek: 5, daysPerMonth: 20,
daysPerWeekInput: 5, daysPerMonthInput: 20,
taskFields: { id: 'TaskID', name: 'TaskName', startDate: 'StartDate', duration: 'Duration', progress: 'Progress', durationUnit: 'DurationUnit', parentID: 'ParentID' },
splitterSettings: { columnIndex: 4 }
};
},
methods: {
updateProperties: function() {
if (this.daysPerWeekInput < 1 || this.daysPerWeekInput > 7) { alert('Days per Week must be between 1 and 7'); return; }
if (this.daysPerMonthInput < 1 || this.daysPerMonthInput > 31) { alert('Days per Month must be between 1 and 31'); return; }
this.$refs.gantt.ej2Instances.daysPerWeek = this.daysPerWeekInput;
this.$refs.gantt.ej2Instances.daysPerMonth = this.daysPerMonthInput;
}
}
};
</script>Unscheduled tasks
Unscheduled tasks are planned for a project without any definite schedule dates. The Gantt Chart component supports rendering the unscheduled tasks. You can create or update the tasks with anyone of start date, end date, and duration values or none. You can enable or disable the unscheduled tasks by using the allowUnscheduledTasks property.
Unscheduled task types
The following images represent the various types of unscheduled tasks in Gantt.
Start date only

End date only

Duration only

Milestone
A milestone is a task that has no start and end dates, but it has a duration value of zero. It is represented as follows.

Define unscheduled tasks in data source
You can define the various types of unscheduled tasks in the data source as follows.
<template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :editSettings= "editSettings" :allowUnscheduledTasks='true'></ejs-gantt>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GanttComponent as EjsGantt, Edit } from "@syncfusion/ej2-vue-gantt";
const data = [
{
TaskID: 1,
TaskName: 'Project Initiation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 2, TaskName: 'Identify Site location', Duration: 3, Progress: 50},
{ TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2019'), Progress: 50 },
{ TaskID: 4, TaskName: 'Soil test approval', EndDate: new Date('04/08/2019'), Progress: 50 },
]
},
{
TaskID: 5,
TaskName: 'Project Estimation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 6, TaskName: 'Develop floor plan for estimation', StartDate: new Date('04/04/2019'), Progress: 50, resources: [4],isParent:false },
{ TaskID: 7, TaskName: 'List materials', StartDate: new Date('04/04/2019'), Progress: 50 },
{ TaskID: 8, TaskName: 'Estimation approval',Duration: 0,Progress: 50}
]
},
];
const height = '450px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate:'EndDate',
duration:'Duration',
progress: 'Progress',
child: 'subtasks'
};
const editSettings = {
allowEditing:true,
}
provide('gantt', [ Edit ]);
</script><template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :editSettings= "editSettings" :allowUnscheduledTasks='true'></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent, Edit } from "@syncfusion/ej2-vue-gantt";
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: [
{
TaskID: 1,
TaskName: 'Project Initiation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 2, TaskName: 'Identify Site location', Duration: 3, Progress: 50},
{ TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2019'), Progress: 50 },
{ TaskID: 4, TaskName: 'Soil test approval', EndDate: new Date('04/08/2019'), Progress: 50 },
]
},
{
TaskID: 5,
TaskName: 'Project Estimation',
StartDate: new Date('04/02/2019'),
EndDate: new Date('04/21/2019'),
isParent:true,
subtasks: [
{ TaskID: 6, TaskName: 'Develop floor plan for estimation', StartDate: new Date('04/04/2019'), Progress: 50, resources: [4],isParent:false },
{ TaskID: 7, TaskName: 'List materials', StartDate: new Date('04/04/2019'), Progress: 50 },
{ TaskID: 8, TaskName: 'Estimation approval',Duration: 0,Progress: 50}
]
},
],
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate:'EndDate',
duration:'Duration',
progress: 'Progress',
child: 'subtasks'
},
editSettings: {
allowEditing:true,
}
};
},
provide: {
gantt: [ Edit ]
}
};
</script>NOTE
If the allowUnscheduledTasks property is set to false, then the Gantt control automatically calculates the scheduled date values with a default value of duration 1 and the project start date is considered as the start date for the task.
Working time range
In the Gantt Chart component, working hours in a day for a project can be defined by using the dayWorkingTime property. Based on the working hours, automatic date scheduling and duration validations for a task are performed.
The following code snippet explains how to define the working time range for the project in Gantt.
<template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :highlightWeekends='true' :splitterSettings= "splitterSettings" :dayWorkingTime="dayWorkingTime" :timelineSettings="timelineSettings" :editSettings= "editSettings"></ejs-gantt>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GanttComponent as EjsGantt, Edit, DayMarkers } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
const data = editingData;
const height = '450px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
};
const editSettings={
allowTaskbarEditing:true
};
const splitterSettings = {
columnIndex: 1
};
const dayWorkingTime = [
{from: 9,
to: 18 }
];
const timelineSettings={
timelineViewMode:'Day'
};
provide('gantt', [ DayMarkers, Edit ]);
</script><template>
<div>
<ejs-gantt ref='gantt' id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :highlightWeekends='true' :splitterSettings= "splitterSettings" :dayWorkingTime="dayWorkingTime" :timelineSettings="timelineSettings" :editSettings= "editSettings"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent, Edit, DayMarkers } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: editingData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
},
editSettings:{
allowTaskbarEditing:true
},
splitterSettings: {
columnIndex: 1
},
dayWorkingTime: [
{from: 9,
to: 18 }
],
timelineSettings:{
timelineViewMode:'Day'
}
};
},
provide: {
gantt: [ DayMarkers, Edit ]
},
};
</script>NOTE
- Individual tasks can lie between any time within the defined working time range of the project.
- The dayWorkingTime property is used to define the working time for the whole project.
Weekend / Non-working days
Non-working days/weekend are used to represent the non-productive days in a project. You can define the non-working days in a week using the workWeek property in Gantt.
<template>
<div>
<ejs-gantt id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :highlightWeekends='true' :workWeek="workWeek"></ejs-gantt>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GanttComponent as EjsGantt, DayMarkers } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
const data = editingData;
const height = '450px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
};
const workWeek = ["Sunday","Monday","Tuesday","Wednesday","Thursday"];
provide('gantt', [ DayMarkers ]);
</script><template>
<div>
<ejs-gantt id="GanttContainer" :dataSource="data" :taskFields = "taskFields" :height = "height" :highlightWeekends='true' :workWeek="workWeek"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent, DayMarkers } from "@syncfusion/ej2-vue-gantt";
import { editingData } from './data-source.js';
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: editingData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
child: 'subtasks'
},
workWeek: ["Sunday","Monday","Tuesday","Wednesday","Thursday"],
};
},
provide: {
gantt: [ DayMarkers ]
}
};
</script>Inactive tasks
The inactive task feature allows specific tasks to be excluded from project scheduling calculations while remaining visible in the Gantt chart. This is useful for representing tasks that are temporarily paused, postponed, inactive, or not yet ready for execution without removing them from the project plan.
When mark a task as inactive:
- The task keeps its row, its own start and end dates, and its stored duration.
- The task is excluded from predecessor scheduling, parent date and work roll-up, and critical path calculation.
- Links attached to the task are kept in the data source. They are not deleted when the task becomes inactive.
Enable inactive tasks
To enable inactive task support, inject the InactiveTask module and map a boolean field from the data source to the inActiveState field in taskFields.
When taskFields.inActiveState is mapped, the Gantt Chart component automatically displays an checkbox column in the Gantt Chart to change the task’s active or inactive state. Also, the state can be changed using edit dialog in advanced tab.
The value true in the mapped data source field marks the task inactive.
The following example demonstrates how to configure inactive task support in the Gantt Chart component.
<template>
<div>
<ejs-gantt ref='gantt' id="Inactive" :dataSource="data" :rowHeight="rowHeight" :taskbarHeight:"taskbarHeight" :treeColumnIndex="1" :taskFields="taskFields" :height="height" :columns = "columns" :splitterSettings = "splitterSettings" :projectStartDate="projectStartDate" :projectEndDate="projectEndDate"></ejs-gantt>
</div>
</template>
<script setup>
import { provide, ref } from "vue";
import { GanttComponent as EjsGantt, InactiveTask, Edit } from "@syncfusion/ej2-vue-gantt";
import { inactiveData } from './data-source.js';
const gantt = ref(null);
const data = inactiveData;
const height = '640px';
const taskFields = {
id: 'TaskID',
name: 'TaskName',
parentID: 'ParentId',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
inActiveState: 'inActive'
};
const rowHeight = 46;
const taskbarHeight = 25;
const columns= [
{ field: 'TaskID', width: 80 },
{ field: 'TaskName', headerText: 'Name', width: 240 },
{ field: 'inActive', headerText: 'Active Task', width: 110 },
{ field: 'StartDate' },
{ field: 'Duration' },
{ field: 'Progress' },
{ field: 'Predecessor' }
];
const splitterSettings= {
columnIndex: 2
};
const labelSettings= {
rightLabel: 'TaskName'
};
cosnt projectStartDate= new Date('03/30/2025');
const projectEndDate= new Date('05/04/2025');
provide('gantt', [InactiveTask, Edit]);
</script><template>
<div>
<ejs-gantt ref='gantt' id="Inactive" :dataSource="data" :rowHeight="rowHeight" :taskbarHeight:"taskbarHeight" :treeColumnIndex="1" :taskFields="taskFields" :height="height" :columns = "columns" :splitterSettings = "splitterSettings" :projectStartDate="projectStartDate" :projectEndDate="projectEndDate"></ejs-gantt>
</div>
</template>
<script>
import { GanttComponent, InactiveTask, Edit } from "@syncfusion/ej2-vue-gantt";
import { inactiveData } from './data-source.js';
export default {
name: "App",
components: {
"ejs-gantt":GanttComponent
},
data: function() {
return{
data: inactiveData,
height:'640px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
parentID: 'ParentId',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
inActiveState: 'inActive'
},
rowHeight : 46,
taskbarHeight : 25,
columns: [
{ field: 'TaskID', width: 80 },
{ field: 'TaskName', headerText: 'Name', width: 240 },
{ field: 'inActive', headerText: 'Active Task', width: 110 },
{ field: 'StartDate' },
{ field: 'Duration' },
{ field: 'Progress' },
{ field: 'Predecessor' }
],
splitterSettings: {
columnIndex: 2
},
labelSettings: {
rightLabel: 'TaskName'
},
projectStartDate: new Date('03/30/2025'),
projectEndDate: new Date('05/04/2025')
},
provide: {
gantt: [InactiveTask, Edit]
}
};
</script>Updating inactive tasks dynamically
The inactive state of a task can be updated at runtime using the updateRecordByID method. Pass the task ID and the data source field that mapped to inActiveState.
To mark a task inactive:
gantt.updateRecordByID({
TaskID: 2,
Inactive: true
});Multiple tasks can be updated in a single call using the updateInActiveTaskStateByID method. Each entry in the array takes the task id and an isInActive value.
gantt.updateInActiveTaskStateByID([
{ id: 2, isInActive: true },
{ id: 4, isInActive: false }
]);After the update, the Gantt Chart recalculates the affected schedule and redraws the tasks that changed. The state change is recorded as a single action, so can undo it with the undo redo feature and the checkbox returns to its previous value.
Parent task behavior
Inactive task status is propagated throughout the task hierarchy to ensure scheduling consistency.
The following rules apply to parent tasks:
- Marking a parent task as inactive automatically marks all of its descendant tasks as inactive.
- A parent task is automatically rendered as inactive when all of its child tasks are inactive.
- Re-activating a child task also re-activates its parent task, while other inactive sibling tasks remain unchanged.
- Parent taskbars are rendered using the inactive visual style whenever the parent task is considered inactive.
Dependency behavior
Dependency relationships are preserved when tasks become inactive. The links remain in the project data and continue to be validated based on the active or inactive state of the connected tasks.
The scheduling behavior varies depending on the state of the predecessor and successor tasks:
- Inactive predecessor, active successor. An inactive predecessor does not influence the schedule of an active successor.
- Active predecessor, inactive successor. The active predecessor still drives the inactive successor, because the predecessor is part of the active schedule.
- Both tasks inactive. The link is still validated, so an inactive successor follows its inactive predecessor as expect for a chain of paused tasks.
- Both tasks active. Nothing changes. The link behaves exactly as it did before the feature was enabled.
While a task is inactive, its own dates are the ones that count. Dragging, resizing, cell editing, and dialog editing an inactive task change only that task’s own dates. They do not move any other task.
Inactive tasks are also excluded from critical path calculations. Therefore, a paused or inactive task never appears on the critical path, and its end date does not affect the project’s critical reference date.
By default, Saturdays and Sundays are considered as non-working days/weekend in a project.
To show or hide weekend in timeline, use timelineSettings.showWeekend property intimelineSettings. To know more aboutshowWeekend, refer here.
In the Gantt Chart component, you can make weekend as working day by setting the includeWeekend property totrue.