Add button to task to duplicate it

Hi everyone,

I’ve been searching the docs but can’t find any documentation about it.

I need to duplicate tasks in the gantt, and was thinking of adding a button next to the ‘Add’ button in each task row that, when clicked, would duplicate the task and insert it below the clicked task.

Is this possible to achieve? Any help would be greatly appreciated.

Thanks in advance!

Hello,
There is no such a feature, but it is easy to implement that. First, you need to create a deep copy of the task, because when you add a task, its ID should be unique. Then you add the task:
https://snippet.dhtmlx.com/ii9u6wbe?text=gantt.%2Bclone
You can learn more about add task and built-in deep copy functions in the following articles:
https://docs.dhtmlx.com/gantt/api__gantt_copy.html
https://docs.dhtmlx.com/gantt/api__gantt_addtask.html

Awesome Ramil, it’s exactly what I was looking for, and thank you very much for taking the time to create a snippet.