Reload GanttChart


How can reload data in gantt chart.


You can use something like next

gantt.clearAll(); gantt.load(data_url);

Reload with your code causes this error:

Uncaught TypeError: Cannot read property ‘$source’ of undefined

Problematic line is:

for(var i=this.getTask(t),a=0;a<i.$source.length;a++)gantt.refreshLink(i.$source[a]);

SOLVED: Whth the new beta version you´ve posted here:

I have the same problem in version 2.1 GPL when using the gantt chart the second time.

I open a form, enter all my data and then cancel. If I open again the form and try to create a new task I got the $source error in line 3737.

Line is:
for(var i=0; i < task.$source.length; i++){

The gantt package has been updated, the latest version can be downloaded here


I just downloaded version 2.1.1 and have the same problem that lillo3. Error is in line 3750.

Can you please help?

Can you please clarify what the problem is?
The original problem was in incorrect behavior of ‘add task’ button, which was causing problem when working with connector.
Steps to reproduce then bug was following:

  1. click ‘plus’ button
  2. click cancel or ‘escape’

lightbox is closed, new task stays


  1. click ‘plus’ button
  2. click cancel or ‘escape’.
  3. click ‘plus’ again


Currently both doesn’t seems to happen -

Please provide an instruction how to reproduce


Here is the code to reproduce the code.


How to Start with dhtmlxGantt

1.-Load the page
2.-Click button on Project #1, to create a task at level 1, for example G2
3.-Click button on G2 to create another task inside G2, for example T1.
4.-Click the Capacity chart button.
5.-Gantt will be reloaded.
6.-Click button on Project #1, to create a task at level 1, for example G2

Error is display as a red box in the upper right corner. Tested with Chrome.


Click the button,

confirmed, we’ll include a fix in the nearest update. For now, you can add gantt.unselectTask() before gantt.clearAll(), it fixes the issue:

gantt.unselectTask(); gantt.clearAll();

Tested and the proposed solutions works great!!!