Hi all,
Let’s say I’ve got administrative tasks like project follow-up, support… I’d like this type of task to be identical to the parent (the project) in terms of start date and duration. Is there an example that shows how to implement this or would you have any suggestions?
regards
Hello,
If you enable the $no_start
and $no_end
properties, the task will work as project tasks and depend on the dates of its child tasks:
https://docs.dhtmlx.com/gantt/desktop__task_properties.html#:~:text=the%20first%20task.-,%24no_start,-boolean
Here is an example:
https://snippet.dhtmlx.com/k3zlbu1m
A another way would be to load those tasks without enough date parameters (start_date
, end_date
, duration
). Gantt will assign the date parameters from their children or from other tasks.
But in any case, you won’t be able to drag or resize these tasks.
You can check how it works in the following sample:
https://snippet.dhtmlx.com/wpxeeiap
Hi ramil and thank you for your answer.
Your two examples work as you mention. However, I’m interested in the opposite: that a child task retrieves its date parameters from the parent task.
Hello,
Child tasks don’t depend on the dates of their parent tasks. If you want to have that functionality, you need to manually implement it by using the Gantt API and Javascript.
For the simple implementation, you can iterate child tasks using the eachTask
method if you specify the parent ID as the second argument:
https://docs.dhtmlx.com/gantt/api__gantt_eachtask.html
If you plan to update several tasks, you need to put your code inside the batchUpdate
method to repaint the changes only once:
https://docs.dhtmlx.com/gantt/api__gantt_batchupdate.html
Here is an example of the implementation:
https://snippet.dhtmlx.com/teirs8v3