I have two problems:-
- I want to hide the parent taskbar and when my screen loads I want to show all children’s taskbar by default in UI.
- 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
ramil
2
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:
Here is an example:
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:
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:
And if I add the Zooming extension, I see the hour scale:
Please clarify what you need in more detail. You can also share a picture that shows how you imagine it should look and work.