Multiple task deletion

I want to delete all the task using that dropdown that appears after we select multiple tasks
in the image you can see the highlighted tasks

need an implementation for this

Hello,
You can use the eachSelectedTask method to iterate selected tasks. The article has the code you need to delete multiple tasks at once:
https://docs.dhtmlx.com/gantt/api__gantt_eachselectedtask.html

Here is more explanation.
If you try to delete a task when it no longer exists, you will get an error. This situation can occur when you deleted a parent task. By default, the child tasks are also deleted. But the eachSelectedTask already iterates the specific array of the task IDs.
Because of that, you need to use the isTaskExists before trying to delete a task:
https://docs.dhtmlx.com/gantt/api__gantt_istaskexists.html

Also, when you delete a task, Gantt calls the render method to repaint the changes as it affects other tasks. If you delete multiple tasks, you will have several repaints. To repaint the changes only once, you need to wrap the code by the batchUpdate method:
https://docs.dhtmlx.com/gantt/api__gantt_batchupdate.html

Here is an example in the snippet:
https://snippet.dhtmlx.com/z77oqdws

1 Like

Will check this

thanks a lot