DHTMLX/gantt

How to disable single task selection when I use multi-select

guyutian opened this issue · 1 comments

hello,
How to disable single task selection when I use multi-select attribute, 'onTaskClick' event doesn't work properly

@guyutian, the onTaskClick event fires after the onBeforeTaskSelected event, so you cannot use it to cancel the task selection with ordinary clicks. You will need to use a different approach.

You can add the mousedown event handler and check if you clicked on a task bar in the timeline or on the task row in the grid. If you didn't press the Shift or Control key, you can save the task ID in a variable. Then you can return false in the onBeforeTaskSelected event handler if the ID matches the task ID.

Here is the snippet:
https://snippet.dhtmlx.com/3umuzpfw