How to hide parent taskbar in gantt timeline?

I have two problems:-

  1. I want to hide the parent taskbar and when my screen loads I want to show all children’s taskbar by default in UI.
  2. I cannot set duration in an hour-in-hour scale in my code so how can I do this?

this is code for duration:-

    const startHour = 10;

    gantt.attachEvent("onTaskLoading", function (task) {
        if (task.parent) {
            task.start_date = gantt.date.add(task.start_date, startHour, 'hour');
            task.duration = task.duration / 60; // convert duration from minutes to hours
            task.end_date = gantt.calculateEndDate({ start_date: task.start_date, duration: task.duration, task: task });
        }
        return true;
    });

@ramil

Hello,

I want to hide the parent taskbar and when my screen loads I want to show all children’s taskbar by default in UI.

You can filter tasks by using the onBeforeTaskDisplay event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskdisplay_event.html

Here is an example:
https://snippet.dhtmlx.com/1o1rbrdd

If you only want to hide the task bar in the timeline and keep the task row, you need to add the hide_bar parameter when loading tasks:
https://snippet.dhtmlx.com/anaaw69z


I cannot set duration in an hour-in-hour scale in my code so how can I do this?

It is not clear to me what you need. When I use the code you shared, I see that the tasks successfully start at the specified dates:
https://snippet.dhtmlx.com/i83qz9c8

And if I add the Zooming extension, I see the hour scale:
https://snippet.dhtmlx.com/ml1d5wbn

Please clarify what you need in more detail. You can also share a picture that shows how you imagine it should look and work.

thanks for the response