DHTMLX/gantt

How to switch the selected status of a task?

Hsensor opened this issue · 1 comments

The onTaskClick method uses gantt.selectTask by default, so how can I toggle the selected/unselected of task !
Why doesn't the onClick method implement toggle the status of the task?

Thank you very much for your reply ! I wish you all the best !

@Hsensor,
You can use the selectTask method to select a task and unselectTask to unselect it:
https://docs.dhtmlx.com/gantt/api__gantt_selecttask.html
https://docs.dhtmlx.com/gantt/api__gantt_unselecttask.html

If you want to unselect a task after clicking on it, you can do it after a timeout:
https://snippet.dhtmlx.com/zaftythc

If you enable the multiselect extension, you will be able to select or unselect a task by holding the Control key and clicking on a task:
https://docs.dhtmlx.com/gantt/desktop__multiselection.html
Here is a sample:
https://docs.dhtmlx.com/gantt/samples/02_extensions/09_multiselection.html