а

Can user input change color of grid_row_class?


#1

I have an app using angular 8 and typescript.

I’m trying to change the colors of the left hand grid

gantt.templates.grid_row_class = function(start, end, task){
 return task.WbsColor; // would like to change background based on this color.
};

Is this possible without creating this in JS that won’t dynamically create these styles and insert them in the header?


#2

Hello,
You can change the row colors without the templates by modifying the DOM elements. But you will have to do it after almost every action. That will affect the performance and won’t always work correctly.
Check how it works in the following snippet:
http://snippet.dhtmlx.com/55a95275d

It would be better if you generate styles from task properties and return the style name in the template.
Here is an example of how it might be implemented:
https://snippet.dhtmlx.com/e62f44c8c


#3

Thanks, that was very helpful!