2.0 MS SQL Connection problem

The default MySQL database connection is working properly.
But I should love to use MS SQL 2008 R2 server.
In first I have problem with the MS SQL datetime type what is basically kills the PHP.
A fair code is ---- date(“Y-m-d”,strtotime(start_date) — what is able to print the date in PHP.
Every other data is pulled.
I have tried to correct the connection.php according to this:

$gantt->render_table(“gantt_tasks”,“id”,“date(‘Y-m-d’,strtotime(start_date)),duration,text,progress,order,parent”);

but the JSONGanttConnector is not able to draw the gantt.

Is it important or some other problems are behind the failure?

My connector.php:

<?php include ('codebase/connector/db_sqlsrv.php'); include ('codebase/connector/gantt_connector.php'); // MS SQL $dbtype = "SQLSrv"; $serverName = "(local)\EWORDOC2"; $connectionInfo = array( "Database"=>"TESZT" ); $conn = sqlsrv_connect( $serverName, $connectionInfo); $gantt = new JSONGanttConnector($conn,$dbtype); $gantt->render_links("gantt_links","id","source,target,type"); //$gantt->render_table("gantt_tasks","id","start_date,duration,text,progress,order,parent"); $gantt->render_table("gantt_tasks","id","date('Y-m-d',strtotime(start_date)),duration,text,progress,order,parent"); ?>

Please, help!
Regards, Peter

Normally you need not to change the format of data during data output, as you can always configure client side to expect the date in your custom format. What is the format of start_date when you are using connector without any formatting ?
docs.dhtmlx.com/gantt/api__gantt … onfig.html

If you still wish to format data, it can be done like

function myFormat($action){ $date = date("Y-m-d",strtotime( $action->get_value("start_date"))); $action->set_value("start_date", $date); } $gantt->event->attach("beforeRender", "myFormat"); $gantt->render_table("gantt_tasks","id","start_date,duration,text,progress,order,parent");

I am sorry to say but the main problem was with the name of the “order” database field.
In the MS SQL 2008 R2 the “order” database field name automatically renamed to [order] database field.
So, the connector.php will be died with fatal error.
I have tried with this:
$gantt->render_table(“gantt_tasks”,“id”,“start_date,duration,text,progress,[order],parent”);
but the [order] is null value.

The nice code with a new “sortorder” database field:
$gantt->enable_order(“sortorder”);
$gantt->render_table(“gantt_tasks”,“id”,“start_date,duration,text,progress,parent”);
without “order” field.

By the way the prettiest debug system is open the connector.php .

Regards Peter

Yep, that was one of reasons to rename order to sortorder.
The docs is not updated yet ( sorry ) but we will remove all traces of “order” field in the next update.

And the “open” datafield — same problem.
Thankx!

Default scheme doesn’t require an “open” datefield, as gantt do not save open|close state of branches.