How to display vacations on gantt (collision handling)


#1

Hi everyone,

I am currently using GPL version of Gantt.
Each task in my case displayed on the same line (render: split).

If a planning task belongs to me which starts 05.06.2019 duraton 5 days but the I am on vacation between 05.06.2019 and 10.06.2019.
There is a “collision” in this case I should have to display with different color in this case.

So, how can I display vacation dates on gantt to be able to handle collisions?
What would be the best solution?

Thanks
Zoltan


#2

Hi @cookiez!

If I understand you correctly you want just display collisions of the tasks and vacation dates on the timeline area.

There are various ways of how it might be implemented.

It can implement by using additional layers.
If you have vacation dates as a string type data modify it to the time object using gantt.date.str_to_date() method:
https://docs.dhtmlx.com/gantt/desktop__date_operations.html#convertingastringtoadateobject

Use addTaskLayer() method to add custom elements for the task crossing the vacation dates:
https://docs.dhtmlx.com/gantt/api__gantt_addtasklayer.html

Use valueOf() method from the public API to compare date values:

Here is a snippet how it can be implemented:
http://snippet.dhtmlx.com/3961083da

Alternatively you can do this using task_cell_class template.
Here is a related article:
https://docs.dhtmlx.com/gantt/api__gantt_task_cell_class_template.html
Here is a related snippet:
http://snippet.dhtmlx.com/991d90ef5

Alternatively you can do this using task_class template.
Here is a related article:
https://docs.dhtmlx.com/gantt/api__gantt_task_class_template.html
Here is a related snippet:
http://snippet.dhtmlx.com/aa3f510dd

You can also check the article and the sample about the working time:
https://docs.dhtmlx.com/gantt/desktop__working_time.html
https://docs.dhtmlx.com/gantt/samples/09_worktime/06_task_calendars.html
Use setWorkTime() method to set the working time for the Gantt chart:
https://docs.dhtmlx.com/gantt/api__gantt_setworktime.html
Use unsetWorkTime() method to unset vacation dates:
https://docs.dhtmlx.com/gantt/api__gantt_unsetworktime.html

Does it resolve your issue? Please let me know if you need something different?