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

Change color

Hi, is possible change the color of tasks and other elements in the gantt?

1 Reply

JD Jayakumar Duraisamy Syncfusion Team January 26, 2017 07:25 AM UTC

Hi Juan Bastidas, 
Thanks for contacting Syncfusion support. 
Please find the response below. 
We can change the color of the tasks and grid cells background in Gantt using queryCellInfo and queryTaskbarInfo client side events.  
We have prepared a sample and updated the taskbar background, progress bar background and TreeGrid cells colors. 
Please find code snippet below. 
queryCellInfo: function (args) { 
    var index = args.data.index; 
    //To change the font color for selected Indexes 
    if (index == 1 || index == 3 || index == 5 || index == 7) 
        $(args.cellElement).css({ "color": "blue" }); 
 
 
}, 
queryTaskbarInfo: function (args) { 
    //To apply background color to parent taskbar 
    if (args.data.hasChildRecords) { 
        //To check the whether custom fields exists or not 
        if (args.data.item.progressbarcolor) { 
            args.parentProgressbarBackground = args.data.item.progressbarcolor; 
        } 
        if (args.data.item.taskbarcolor) { 
            args.parentTaskbarBackground = args.data.item.taskbarcolor; 
        } 
    } 
        //To apply background color to taskbar 
    else { 
        if (args.data.item.progressbarcolor) { 
            args.progressbarBackground = args.data.item.progressbarcolor; 
        } 
        if (args.data.item.taskbarcolor) { 
            args.taskbarBackground = args.data.item.taskbarcolor; 
        } 
    } 
}, 
 
Please refer the KB inks for more information. 
Please refer following UG links to know more about “queryCellInfo” & “queryTaskbarInfo” events and it’s arguments: 
We also prepared sample for your reference. 
 
Regards, 
Jayakumar Duraisamy

Loader.
Up arrow icon