Our state of the art Gantt chart


Post by mv2022 »

After the user selects an item from the drop-down list, I would like to do this.gantt.refreshRows();. Is there a way to add a listener to the drop-down column and fire an event after the user has finished selecting the item?

Something like this ?

  private createCustomDropDownColumns(fieldName: string, textName: string, data: string[]): void {
    this.gantt.columns.add({
      field: fieldName, text: textName, editor: {
        type: 'dropdown',
        items: data,
        listeners: { // This does not work. 
          finishCellEdit({ editorContext }) { 
            this.gantt.refreshRows();
          }
        }
      }
    });
  }

Post by tasnim »

Please just add the listeners object to ganttConfig, then it'll work.


Post by mv2022 »

I tried doing that, but it doesn't seem to work.

app.config

export const ganttConfig = {
    project : {
        // no data
    },

columns : etc ...

listeners : {
    finishCellEdit({ editorContext } : any) {
        const { record, editor, column } = editorContext;
        console.log(record);
        console.log(editor);
        console.log(column);
 
   }
}

};

html

<bryntum-project-model
    #project
    [calendar]     = "projectConfig.calendar!"
    [startDate]    = "projectConfig.startDate!"
    [hoursPerDay]  = "projectConfig.hoursPerDay!"
    [daysPerMonth] = "projectConfig.daysPerMonth!"
    [tasks]        = "tasks"
    [taskStore]    = "{fields : ['city']}"
    [timeRanges]   = "timeRanges"
    [assignments]  = "assignments"
    [resources]    = "resources"
    [dependencies] = "dependencies"
    [calendars]    = "calendars"
    ></bryntum-project-model>
    <bryntum-gantt
    [project]           = "project"
    [columnLines]       = "ganttConfig.columnLines"
    [columns]           = "ganttConfig.columns"
    [subGridConfigs]    = "ganttConfig.subGridConfigs"
    [viewPreset]        = "ganttConfig.viewPreset"
    [timeRangesFeature] = "ganttConfig.timeRangesFeature"
</bryntum-gantt>

Post by tasnim »

You need to add the listeners property into the <bryntum-gantt> like this below:

[listeners] = "ganttConfig.listeners"

Then it'll work.


Post Reply