Changing the parent task gantt task line

How do I change the UI of the Gantt task line if it is a parent task?

Hello @Asyong,

You can check if the task is a parent using the hasChild method:
https://docs.dhtmlx.com/gantt/api__gantt_haschild.html

After that, you will be able to style this task using the “task_class” template, which is the default gantt solution to stylize tasks:
https://docs.dhtmlx.com/gantt/api__gantt_task_class_template.html

It may look like the following fragment:

gantt.templates.task_class = function(start, end, task){
  if(gantt.hasChild(task.id))
    return "project-styles";
};

Here is a demo(HTML/CODE tabs):
http://snippet.dhtmlx.com/5/b64c4f3e3

1 Like