Grid row coloring

I am trying to color the grid row if the progress is >99. I am using this function, and it only colors every other row. I need help trying to figure it out.

Thanks!

.color {background-color:#3ac944;}

gantt.templates.grid_row_class =
gantt.templates.grid_row_class = function (start, end, task) {
if (task.progress > 99) {
return “color”;
}
};

Hi @RonM,
The source of this error is that every odd task has a specific class “.odd”.
Use more specific rules in styles to get around it like this
.gantt_grid_data .color,
.gantt_grid_data .color.odd {
background-color:#3ac944;
}
.gantt_grid_data .color:hover,
.gantt_grid_data .color.odd:hover {
background-color:#2e9f36;
}

Here is a sample, where you can see how it can be implemented :
http://snippet.dhtmlx.com/25300a589

1 Like

Thanks Guldmi,

That worked!