Show the "add node" (plus) icon for certain tasks

Can you tell me how to only show the “add node” (plus) icon for certain tasks? Only those tasks of a certain level are allowed to have children (if root is 1 and leaf is 4, then only level 3 is allowed to add leaves).

Hello,
the preventing from adding new tasks to specific tasks can be done using a CSS class and grid_row_class template. You can read more about it in the article:
https://docs.dhtmlx.com/gantt/desktop__specifying_columns.html#hidingtheaddbuttonforcertaintasks
You can also watch the video guide:


In order to determine the level of nesting of the task, please use calculateTaskLevel() method. Here is a piece of code with how this can be done:
gantt.templates.grid_row_class = function (start, end, task) {
  var level = gantt.calculateTaskLevel(task);
  if (level == 2) {
return "";
  } else return "regular-task";  
};

Here is a snippet:
http://snippet.dhtmlx.com/5/a5b781096