Description: Custom Task Columns with custom content.

https://www.jqwidgets.com/

jQuery Gantt: Task columns

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.

jqxGantt API used in this demo

Source code

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, jqxbuttons.js, jqxscrollbar.js, jqxlistbox.js, jqxdropdownlist.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

window.onload = () => {
     const gantt = new jqxGantt('#gantt', {

         columnMinWidth: '30%',
         treeSize: '25%',
         view: 'day',
         width: 700,
         height: 'auto',
         taskColumns: [{
             label: 'Labels',
             value: 'label',
             //Column min size
             size: 100,
             //Column size
             minWidth: '30%',
             //Custom format function
             formatFunction: function (label) {
                 if (label === 'Learn') {
                     return ' <i class="material-icons">&#xE80C;</i>' + label;
                 }
                 else if (label === 'Work') {
                     return ' <i class="material-icons">&#xE30A;</i>' + label;
                 }
                 else if (label === 'Travel') {
                     return ' <i class="material-icons">&#xE53D;</i>' + label;
                 }
                 else if (label === 'Eat') {
                     return ' <i class="material-icons">&#xE56C;</i>' + label;
                 }
                 else if (label === 'Shop') {
                     return ' <i class="material-icons">&#xE25C;</i>' + label;
                 }
                 else if (label === 'Train') {
                     return ' <i class="material-icons">&#xE52F;</i>' + label;
                 }
                 else {
                     return label;
                 }
             }
         },
         {
             label: 'Date Start',
             value: 'dateStart',
             //Custom format function
             formatFunction: (date) => new Date(date).toLocaleDateString('en', { hour: '2-digit', minute: '2-digit' }),
             minWidth: 100
         },
         {
             label: 'Date End',
             value: 'dateEnd',
             size: '25%',
             minWidth: '30%'
         }
         ],
         source: [
             {
                 label: 'Learn',
                 dateStart: '2026-02-07T7:00:00',
                 dateEnd: '2026-02-07T12:00:00',
                 type: 'task',
                 connections: [
                     {
                         target: 1,
                         type: 1
                     }
                 ]
             },
             {
                 label: 'Work',
                 dateStart: '2026-02-07T7:00:00',
                 dateEnd: '2026-02-07T17:30:00',
                 type: 'task',
                 connections: [
                     {
                         target: 3,
                         type: 1
                     }
                 ]
             },
             {
                 label: 'Eat',
                 dateStart: '2026-02-07T12:00:00',
                 dateEnd: '2026-02-07T13:00:00',
                 type: 'task'
             },
             {
                 label: 'Shop',
                 dateStart: '2026-02-07T18:45:00',
                 dateEnd: '2026-02-07T19:30:00',
                 type: 'task',
                 connections: [
                     {
                         target: 5,
                         type: 1
                     }
                 ]
             },
             {
                 label: 'Train',
                 dateStart: '2026-02-07T20:00:00',
                 dateEnd: '2026-02-07T21:45:00',
                 progress: 50,
                 type: 'task'
             },
             {
                 label: 'Travel',
                 dateStart: '2026-02-07T23:00:00',
                 dateEnd: '2026-02-08T06:00:00',
             }
         ]
     });
 };

body.html

<p>
    <b>Description:</b> Custom Task Columns with custom content.
</p>
<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>

Learn more

More jQuery Gantt demos