gantt icon indicating copy to clipboard operation
gantt copied to clipboard

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

Open guyutian opened this issue 2 years ago • 1 comments

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

guyutian avatar Jul 18 '23 02:07 guyutian

@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

gearcoded avatar Aug 22 '23 08:08 gearcoded