Gantt Chart can be sorted by columns by clicking on the header of the desired column. The first click on the header will sort the Tasks in 'ascending' order. Second click will sort them in 'descending' and the third will remove the sorting.
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.durationUnit property – Determines in what unit is task duration property measured.showBaseline property – Determines whether the baselines of the tasks are visible or not.taskColumns property – Determines the columns that will be visible in the Task Tree.treeSize property – Determines the size(width) of the task table.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", {
treeSize: '30%',
durationUnit: 'hour',
showBaseline: true,
taskColumns: [
{
label: 'Tasks',
value: 'label',
size: '60%'
},
{
label: 'Duration (hours)',
value: 'duration',
formatFunction: (date) => parseInt(date)
}
],
source: [
{
label: 'Project Start',
dateStart: '2026-01-06',
type: 'milestone'
},
{
label: 'PRD & User-Stories',
dateStart: '2026-01-06',
dateEnd: '2026-03-06',
class: 'product-team',
planned: {
dateStart: '2026-01-06',
dateEnd: '2026-03-06'
},
type: 'task'
},
{
label: 'Persona & Journey',
dateStart: '2026-02-25',
dateEnd: '2026-04-26',
class: 'marketing-team',
planned: {
dateStart: '2026-02-25',
dateEnd: '2026-04-26'
},
type: 'task'
},
{
label: 'Architecture',
dateStart: '2026-04-07',
dateEnd: '2026-05-12',
class: 'product-team',
planned: {
dateStart: '2026-04-07',
dateEnd: '2026-05-12'
},
type: 'task'
},
{
label: 'Prototyping',
dateStart: '2026-05-13',
dateEnd: '2026-06-27',
class: 'dev-team',
planned: {
dateStart: '2026-05-13',
dateEnd: '2026-06-27'
},
type: 'task'
},
{
label: 'Design',
dateStart: '2026-06-28',
dateEnd: '2026-07-28',
class: 'design-team',
planned: {
dateStart: '2026-06-28',
dateEnd: '2026-07-28'
},
type: 'task'
},
{
label: 'Development',
dateStart: '2026-07-28',
dateEnd: '2026-09-06',
class: 'dev-team',
planned: {
dateStart: '2026-07-28',
dateEnd: '2026-09-06'
},
type: 'task'
},
{
label: 'Testing & QA',
dateStart: '2026-09-07',
dateEnd: '2026-10-06',
class: 'qa-team',
planned: {
dateStart: '2026-09-07',
dateEnd: '2026-10-06'
},
type: 'task'
},
{
label: 'UAT Test',
dateStart: '2026-10-08',
dateEnd: '2026-11-07',
class: 'product-team',
planned: {
dateStart: '2026-10-08',
dateEnd: '2026-11-07'
},
type: 'task'
},
{
label: 'Handover & Documentation',
dateStart: '2026-10-13',
dateEnd: '2026-11-27',
class: 'marketing-team',
planned: {
dateStart: '2026-10-13',
dateEnd: '2026-11-27'
},
type: 'task'
},
{
label: 'Release',
dateStart: '2026-10-28',
dateEnd: '2026-12-27',
class: 'release-team',
planned: {
dateStart: '2026-10-28',
dateEnd: '2026-12-27'
},
type: 'task'
},
{
label: 'Project End',
dateStart: '2026-11-27',
type: 'milestone'
}
]
});
};
<div>
<p>Gantt Chart can be sorted by columns by clicking on the header of the desired column. The first click on
the header will sort the Tasks in 'ascending' order. Second click will sort them in 'descending' and the
third will remove the sorting.</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>