Multi-Task Selection Delete + Keyboard navigation problem

Hi!
While I was trying to incorporate “multi-task delete”, I found this error

UI:

CODE:
image
image
image

Hello,
Before deleting the task you need to check if that task exists. So you can replace the following string:

gantt.deleteTask(task_id);

to:

if(gantt.isTaskExists(task_id)) gantt.deleteTask(task_id);

Thank you for your reply, although, as you can see in my code, I already had that condition before the line you mentioned, therefore I don’t think adding the condition again inside would fix the issue.

image

Hello,
Sorry, didn’t notice that.
And unfortunately, I couldn’t reproduce that. There is a similar issue, maybe it happens with you,
When you highlight a task but delete its parent task, there is an error when you try adding a new task. It happens because Gantt doesn’t unselect deleted task.
As a workaround you can try unselecting it manually:

gantt.unselectTask(id);

If that doesn’t help you, please reproduce the issue in the following snippet, click on the “Share” button and copy the link.
https://snippet.dhtmlx.com/b3e34d9d5

1 Like