I am trying to setup the basic gantt chart using a database connector with a PDO connection following the How to Start instructions. When I make changes or create a new task I do not see the changes saved in the database, and when I try to create a link between two tasks I receive this alert:
Error type: LoadXML
Description: Incorrect XML
I’m not sure if this is related but I had to manually create a record in the database to get the + buttons to work. Otherwise I received a TypeError: ‘undefined’ is not an object (evaluating ‘date.getFullYear’) when trying to create a new Task in an empty chart.
Here is my client code…
gantt.config.xml_date = "%Y-%m-%d %H:%i";
gantt.init("show_gantt");
gantt.load('nim/n_show_gantt_data.php');
var dp=new dataProcessor("nim/n_show_gantt_data.php");
dp.init(gantt);
Here is my server code…
include 'n_proj_connect_pdo.php'; //RETURNS $db_res as resource
include '../_plugins/dhtmlxGantt/connector/db_pdo.php';
include '../_plugins/dhtmlxGantt/connector/gantt_connector.php';
$gantt = new JSONGanttConnector($db_res, "PDO");
$gantt->render_links("gantt_links","id","source,target,type");
$gantt->render_table("gantt_tasks","id","start_date,duration,text,progress,sortorder,parent");
Thanks for the fast response… I’ve attached a copy of the log. It appears it might be an issue with the timezone not being set as well as the sortorder field.
target to a BIGINT instead of just INT
You need to have id field in both tables as auto-increment
The bigInt value is a temporary ID from client side, and it is expected that it will be replaced with DB generated ID during saving
I believe the link was trying to save the BIGINT because the gantt_task had actually failed saving. I do have the id’s auto-incrementing but since it failed saving the task due to an invalid sortorder the task was available in the UI but the DB never created an ID for it. Therefore, when I went to add the link it was using the temp BIGINT id as the target and failing again. Once I fixed the sortorder field and had the gantt_tasks saving properly the gantt_links worked.