Description: Synchronized parent project with nested project that has sub-tasks. Drag/Resize it's sub-tasks to see how the root project is recalculated.
JavaScript Gantt with nested projects.
A live JavaScript/jQuery example of jqxGantt, the jQWidgets Gantt component, with its complete source code below. It is one of 15 jqxGantt demos for jQuery.
source property – Determines the tasks that will be loaded inside the Timeline.dateEnd property – Determines a specific end date for the Timeline.dateStart property – Determines a specific starting date for the Timeline.tasks property – A getter that returns a flat structure as an array of all tasks inside the element.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxgantt.js, jqxgantt.api.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
window.onload = () => {
const gantt = new jqxGantt("#gantt", {
source: [
{
//Note: min/max of syncronized projects are automatically calculated based on the tasks
label: 'Project 1',
synchronized: true,
expanded: true,
type: 'project',
tasks: [
{
label: 'Task 1.1',
minDateStart: '2026-02-06',
maxDateEnd: '2026-08-06',
dateStart: '2026-2-06',
dateEnd: '2026-4-06',
type: 'task'
},
{
label: 'Task 1.2',
minDateStart: '2026-3-06',
maxDateEnd: '2026-11-06',
dateStart: '2026-3-06',
dateEnd: '2026-6-06',
type: 'task'
},
{
label: 'Milestone 1',
dateEnd: '2026-3-11',
type: 'milestone'
},
{
label: 'Project 2',
dateStart: '2026-4-06',
dateEnd: '2026-01-11',
expanded: true,
type: 'project',
tasks: [
{
label: 'Task 2.1',
minDateStart: '2026-2-06',
maxDateEnd: '2026-08-06',
dateStart: '2026-4-06',
dateEnd: '2026-5-06',
type: 'task'
},
{
label: 'Task 2.2',
minDateStart: '2026-03-06',
maxDateEnd: '2026-11-06',
dateStart: '207-05-10',
dateEnd: '2026-6-06',
type: 'task'
},
{
label: 'Milestone 2',
dateEnd: '2026-7-16',
type: 'milestone'
}
]
}
]
},
{
type: 'task',
label: 'Task 3',
dateStart: '2026-6-17',
minDateStart: '2026-06-01',
maxDateStart: '2026-07-01',
dateEnd: '2026-12-06',
minDateEnd: '2026-11-27',
maxDateEnd: '2026-12-21'
},
{
type: 'task',
label: 'Task 4',
dateStart: '2026-10-01',
dateEnd: '2026-12-06',
progress: 50,
maxDuration: 60 * 24 * 60 * 60 * 1000 //60 days in miliseconds
}
]
});
};
<div>
<p>
<b>Description:</b> Synchronized parent project with nested project that has sub-tasks. Drag/Resize it's
sub-tasks to see how the root project is recalculated.
</p>
</div>
<div id="gantt"></div>
<div style="position: absolute; bottom: 5px; right: 5px;">
<a href="https://www.jqwidgets.com/" alt="https://www.jqwidgets.com/"><img alt="https://www.jqwidgets.com/" title="https://www.jqwidgets.com/" src="https://www.jqwidgets.com/wp-content/design/i/logo-jqwidgets.png"></a>
</div>