I’m not sure if I understood your question correctly. If you want to apply your different classes to the grid and tasks, so you need to return the required CSS class which suits the desired conditions.
Please check the example: DHTMLX Snippet Tool ;
If you meant something different, please clarify your question.
yesss you can, but ensure you use a space-separated list of classes and that your CSS is correctly targeting these classes. to set the background color of the entire row for a parent task, you can use the task_class property in your Gantt configuration to apply a specific class, then style that class in your CSS. for example:
Hello,
Gantt can have only one template with the same name. So, if you define the template multiple times with the different code, only the last one will work:
// this template won't work because it will be replaced by the lower template
gantt.templates.grid_row_class = function (start, end, task) {
if (task.type === 'project') {
return "project-row";
}
};
// only this template will work as it will replace all other template configurations above
gantt.templates.grid_row_class = function (start, end, task) {
// added the semi-transparent to the grid
if (task.isHidden && task.semiTransparent) {
return "semi-transparent";
}
return "";
};
If you have several conditions, you need to return all of them within the same template:
gantt.templates.grid_row_class = function (start, end, task) {
const css = [];
if (task.type === 'project') {
css.push("project-row")
}
// added the semi-transparent to the grid
if (task.isHidden && task.semiTransparent) {
css.push("semi-transparent");
}
return css.join(" ");
};