Search code examples
dhtmlxdhtmlx-scheduler

DHTMLX gantt chart hide parent tasks how?


In DHTMLX Gantt chart

I need to show all hierarchy structure tasks in left panel like

  1. Parent
    1.1 SubParent
    1.1.1 Tasks

But Right side panel i need to show only child tasks not parent and subparent.

You can refer below screen shot'enter image description here

Reference Link : https://dhtmlx.com/docs/products/dhtmlxGantt/02_features.html

Need: 1. I need to hide strategic Definition and Obtain/create... right side blue bar only.


Solution

  • Please use task_class template to specify the CSS class that will be applied to task bars with children to hide them

    and getChildren method to check if the target task has got the 1st-level child tasks:

    gantt.templates.task_class = function(start, end, task){
      var children = gantt.getChildren(task.id);
      if(children.length)
        return "hideTask";
    
      return "";
    };
    

    CSS:

    .hideTask{visibility: hidden;}
    

    Demo