
How to display the add button for job types (project), and not the add button for other types of jobs.There is also which event is triggered by add
Hello,
You need to add a custom “+” button. To do that, you need to use the template function in the column configuration, which allows you to return any text or HTML elements:
https://docs.dhtmlx.com/gantt/desktop__how_to.html#howtoaddacustomaddbutton
https://docs.dhtmlx.com/gantt/desktop__specifying_columns.html#datamappingandtemplates
In that function, you can add a condition to return the button or not.
If you return an HTML element with the gantt_add class name, Gantt adds the “+” button.
Here are examples:
https://snippet.dhtmlx.com/khi7mtcm
https://snippet.dhtmlx.com/1ih6xa67
https://snippet.dhtmlx.com/4nmc187d
Alternatively, you can hide the button by returning a custom class name in the grid_row_class template and adding the styles to hide the button:
https://docs.dhtmlx.com/gantt/api__gantt_grid_row_class_template.html
Here is an example:
If you use the built-in “+” button (or a custom element with the gantt_add class name), Gantt calls the createTask method:
https://docs.dhtmlx.com/gantt/api__gantt_createtask.html
After that, Gantt calls the onTaskCreated event:
https://docs.dhtmlx.com/gantt/api__gantt_ontaskcreated_event.html
Then Gantt calls the onBeforeLightbox and onLightbox events:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforelightbox_event.html
https://docs.dhtmlx.com/gantt/api__gantt_onlightbox_event.html
If you use a custom button that doesn’t have the gantt_add class name, Gantt doesn’t do anything with that. It is up to you to attach event handlers to the button. Then the event triggering depends on the methods you use.