[Angular + Gantt] Issue with Multiple Gantt Instance


Hi Team,

We have recently bought Gantt License and we were integrating it.
We have a dropdown and on change in the value in Dropdown Gantt needs to re-rendered.
First time it’s loading fine, but 2nd time i.e. when we change value from Dropdown, Gantt Chart is not rendering.
On changing value in Dropdown, Data to be displayed in the Gantt Chart changes so we are taking destructuring approach.

Following is the Code.

renderGanttChart() {
  if(this.ganttInst) {
        this.ganttInst = null;
   if(this.data.length > 0) {
      this.ganttInst = Gantt.getGanttInstance();
      this.setGanttData();  // Setting Gantt Data
      this.setDefaultGanttConfig(); // Setting Gantt Config's
  }  }

Can you please help me out here if I am doing wrong?
Also please suggest me if this is the suggested approach.

Bhavesh Kumar.


Hello Bhavesh,
It is hard to suggest what might be wrong as I don’t see your full code.
In Angular, there is a common approach for creating a new Gantt instance when opening a page/tab with Gantt and destroying it when switching to another page/tab.
I have the following Angular demo with that approach:

If you can reproduce the issue there, please send me the updated Angular demo so that I can reproduce the issue locally and check what might be wrong.