Add Task in column to custom index

Hi,

When I click the ‘+’ icon in the column to add a task, I’d like this to add to an index I specify. I know that you’re able to pass in an optional index with the method addTask, but how do I do this in the add task column?

I’d like the add task in column to be linked to index 1.

Thanks,
testuser3

Hello,
Unfortunately, I couldn’t fully understand what you need to get. Do you need to execute a custom function after clicking on the + icon? If yes, you need to add new column where you return a div that will look like the + icon and has the events you need. Here is an example:
https://snippet.dhtmlx.com/c37857627

If you need something else, please clarify.

Hi ramil,

Thanks for your reply. When I click the add task icon in the column, I want to add the task as a nested task instead of being on index 0. I want it to add the task to index 1. https://docs.dhtmlx.com/gantt/api__gantt_addtask.html

I should be able to use the custom add snippet and manually call addTask and specify index 1, but is there a built it way to set the index for where add task goes in the column?

-testuser3

Better yet, how do I just disable the add task on the header? I just want the “+” icon on the header to be an image without having any action associated to clicking it.

I found this css update to be the best solution for disabling add task on the header:

.gantt_grid_head_cell.gantt_grid_head_add {
  pointer-events: none;
}

Hello,
Thank you for the clarification.
Here is the updated snippet:
http://snippet.dhtmlx.com/1b247fefc
There will won’t see + icon on the header and when you add a task, it will have index 1 or second task in the branch.

Awesome, thanks ramil!

hey @testuser3 @ramil How to add task using create task on custom index i.e I want to add the new
task above the clicked task.

Hello,
The answer to this question you can find here:I am trying to add new task in gantt in between instead of adding in last in activity log. When user clicks on any tasks he gets the option “add above” and the task gets added above the clicked task
Please, don’t duplicate your questions.