Load/save several gantt datas in the same database


I’m a new member
is it possible to save datas provided by several Gantt into the same tables gantt_links and gantt_tasks ?
… thus, is it possible to load and display datas of a specific gantt, using for example an additionnal field (which is representative to the specific gantt) in tables gantt_links and gantt_tasks ?
if exists, what is the best way to manage this need ?
waiting for your answers


Hello Lenajo,
In theory, it should be possible by using onTaskLoading event handler:
But there is a bug that prevents from loading any data if you return false. We know about that bug, and it will be fixed in the future.

So now you need to load the data from the server into a JSON variable and create make another JSON variables that will contain the data for each Gantt.
Here is an example of how it might be implemented:


Hello Ramil,

thank you for your reply
onTaskLoading seems to work properly

However, I prefer to filter the data into the SQL query rather than loading all data and filtering them before display
so, I’m using render_sql in data.php :

<?php include ('codebase/gantt_connector.php'); $res = new PDO("mysql:host=localhost;dbname=dhtmlxgantt", "usergantt", "passwordgantt"); $gantt = new JSONGanttConnector($res); $gantt->render_links("gantt_links","id","source,target,type"); $gantt->render_sql("SELECT * FROM gantt_tasks WHERE parent=3","id","start_date,end_date,duration,text,progress,sortorder,parent"); ?>

it works fine for loading data (and probably quicker than the suggested method) but …
… it doesn’t work for updating data :frowning_face:
updating data needs $gantt->render_table(“gantt_tasks”,“id”,“start_date,end_date,duration,text,progress,sortorder,parent”);

what is it the right way ?


Hello Lenajo,
Unfortunately, I couldn’t reproduce it.
If I use the following string:

$gantt->render_sql("SELECT * FROM gantt_tasks_preventivi WHERE id > 13","id","start_date, duration, text, progress, parent, color, textColor");

If I resize a task or change its progress it works the same way i as if I use the following string:

$gantt->render_table("gantt_tasks_preventivi", "id", "start_date, duration, text, progress, parent, color, textColor"); 

Here is the video: