Our state of the art Gantt chart


Post by mv2022 »

When creating a subtask or a new task, is there a way to give it a unique ID? Sometimes when adding a subtask or a task below / above, I get an error message 'bryntum Error: Id collision on _generatedClassDefEx19'.

features: {
    taskMenu: {
      items: {
        add: {
          menu: {
            subtask: {
              onItem: async ({ source: gantt, taskRecord }) => {
                // give a unique id when inserting the taskRecord
                const task = await gantt.addSubtask(taskRecord);
                task.system = gantt.taskStore.first.originalData.system;
                task.worktype = gantt.taskStore.first.originalData.worktype;
                gantt.project.commitAsync();
              }
            },

Post by tasnim »

I cannot reproduce it. I tried reproducing it here https://bryntum.com/examples/gantt/basic/
addSubTask function shouldn't need any unique id. Could you please provide a runnable test case and steps to reproduce?


Post by mv2022 »

It's hard to reproduce in the demo project. But when loading from the database, sometimes when adding a new task or subtask I get the error message. If possible, when adding a subtask, task above and below, I would like to add my own unique ID rather than something like this . '"id" : "generatedClassDefEx19". I think this should solve the error message for the Id collision.


Post by tasnim »

You can add your own id like this :

const task = await gantt.addSubtask(taskRecord);
task.id = 'unique_id';

Post Reply