Different task creation Lightbox depending on + clicked

Hi all,

in my scenarios, I have Projects at level 0 and tasks under.

I defined differents lightboxes to edit Projects and tasks.

When I clic on the + button, I always have the same lightbox Openning ( Tasks one ).

I would like to :

  • open the Project lightbox when the user clics on the “Header” + button
  • open the Task lightbox when the user clics on a “Task” + button

I can differ what + is clicked in the onBeforeLightbox event (using task.$level for example), but at this point, setting task.$rendered_type as “project” does not seem to help.

What is the correct way to tell dhtmlxgannt that I want a Project or a Task Lightbox at this point ?

Thanks for your help !

Ok, finally found, here it is if it may help :

gantt.attachEvent("onBeforeLightbox", (id) => {
  var task = gantt.getTask(id);

  if(task.$level == 0){
    task.type = gantt.config.types.project;
  return true;

Hello Julien,
You can also add a custom element in the “+” button in the grid header, attach the onclick function and use the changeLightboxType method:
The following snippet demonstrates how it works: