DHTMLX / gantt

GPL version of Javascript Gantt Chart
https://dhtmlx.com/docs/products/dhtmlxGantt/
GNU General Public License v2.0
1.5k stars 327 forks source link

How to switch the selected status of a task? #92

Closed Hsensor closed 1 month ago

Hsensor commented 1 year ago

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 !

gearcoded commented 1 year ago

@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