The disposed() method returns true if the JavaScript Gantt Chart component has already been disposed using DayPilot.Gantt.dispose().
DayPilot.Gantt.disposed()This method has no parameters.
Returns true when the component has already been disposed; otherwise returns false.
if (gantt.disposed()) {
return;
}