Creating Link fails: Error type: LoadXML

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,
Andrew

And here are the tables in the db…

gantt_tasks
id int(11)
start_date date time
duration int(11)
text varchar(255)
progress float
sortorder int(11)
parent int(11)

gantt_links
id int(11)
source int(11)
target int(11)
type varchar(1) latin1_swedish_ci

Please try to enable log for the connector, it will provide some more info about the problem.
Also, which kind of DB you are using with PDO ?

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.

I am using mysql as the db with a PDO connection.

Thanks,
Andrew
gantt_log.zip (1.58 KB)

I was able to get it all working. I did have to make some changes to the DB entries. First I set my default timezone on the data.php.

Then I changed the datatype for gantt_tasks : sortorder to VARCHAR instead of int since it was receiving ’ ’ as a value.

I also had to change gantt_links : target to a BIGINT instead of just INT as the value it was trying to receive was out of scope.

Now it all seems to be working properly.

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.

Yep, it may be the reason as well.
In any case, there is no need to use BIGINT as id field type.