We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

Formatting Gantt elements in Angular

In Gantt, it is possible to format the user interfaces such as taskbar background, cell background and format the cell values for specific rows/cells using queryCellInfo and queryTaskbarInfo client side events. The queryCellInfo event will be triggered while rendering each cell in TreeGrid and the queryTaskbarInfo event will be triggered while rendering each taskbar in Gantt.

We can get the style attributes of the elements from the event arguments, we can either change the property value or directly apply CSS styles to the element.

<ej-gantt id="GanttControl" [datasource]="ganttData" taskidmapping="taskID" tasknamemapping="TaskName" startdatemapping="startDate" enddatemapping="endDate" progressmapping="progress" durationmapping="duration"              [childmapping]="childMapping" [treecolumnindex]="treeColumnIndex" [editsettings]="editSettings" [toolbarsettings]="toolbarSettings" (load)="load($event)" (querycellinfo)="queryCellEvent($event)" (querytaskbarinfo)="queryTaskbar($event)"
              sizesettings.height="450px" sizesettings.width="100%">


queryTaskbar(args) {
            var data = args.data.item;
            if (data.progress > 80) {
                args.progressbarBorder = args.progressbarBackground = "#6C3483";
                args.taskbarBorder = args.taskbarBackground = "#A569BD";
                $(args.taskbar).find(".e-gantt-childtaskbar-progress").css("background-image", "none");
            else if (data.progress < 20) {
                args.progressbarBorder = args.progressbarBackground = "#CD5C5C";
                args.taskbarBorder = args.taskbarBackground = "#F08080";
                $(args.taskbar).find(".e-gantt-childtaskbar-progress").css("background-image", "none");
            if (args.data.index == 6) {
                $(args.taskbar).css({ "backgroundColor": "#FFB2B2" });
        queryCellEvent(args) {
            var data = args.data.item,
                model = args.model;
            if (args.column.mappingName == model.progressMapping) {
                if (data.progress > 80) {
                    $(args.cellElement).css("background-color", "#A569BD");
                else if (data.progress < 20) {
                    $(args.cellElement).css("background-color", "#F08080");
            if (args.data.index == 6)
                $(args.cellElement).css({ "backgroundColor": "#FFB2B2" });


Format the taskbar background, cell background and format cell values for specific rows/cells.

A simple sample to highlight a row, cell and taskbar in Gantt is available here

You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile