Hi,
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
regards
Hello Lenajo,
In theory, it should be possible by using onTaskLoading
event handler:
https://docs.dhtmlx.com/gantt/api__gantt_ontaskloading_event.html
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:
http://snippet.dhtmlx.com/d91452365
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 :
it works fine for loading data (and probably quicker than the suggested method) but …
… it doesn’t work for updating data
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:
https://files.dhtmlx.com/30d/d43d984bd0d1ccf871ff88048382203f/vokoscreen-2019-03-19_14-45-21.avi