dhtmlxTree population through sql database table

Hi all
I am trying to populate a tree with a sql database table which has the structure as below:
ID NODE PARENT
1 N1 0
2 N2 0
3 N11 N1
4 N12 N1
5 N111 N11
6 N112 N11
7 N1111 N111
8 N1112 N111
9 N121 N12
10 N1211 N121
11 N21 N2
Hope you get the idea. I am trying to use the “tree_connector” to get the job done. The thing is when i debug my code, the execution seems to have happened but nothing gets populated in the tree. Below are the code fragments:

CONNECTOR:
$treeConn = new TreeConnector($DB, “MsSQL”);
$treeConn->render_sql(“SELECT ID, NODE, PARENT FROM treeTable”, “”, “, “,””,“NODE”);

For rendering:
myTree = this.createTree(element);
dpA = new dataProcessor(“connector/connector_TagTree.php”);
dpA.init(myTree);
myTree.load(“connector/connector_TagTree.php”);

Please help.
TIA.

Hi,

you need to correct render_sql() call. Try something as in:

$treeConn->render_sql(“SELECT ID, NODE, PARENT FROM treeTable”, “ID”, “NODE”,"",“PARENT”);

or

$treeConn->render_table(“treeTable”, “ID”, “NODE”,"",“PARENT”);

Please see the samples in connector package.

Thanks Alexandra for your response.
Sorry about the typo in my query.
I tried what you mentioned but its still not working.
The response XML is still blank, I double checked my query and it is returning results.
Any suggestions?

You can enable error log for the connector:

$treeConn->enable_log(“error.log”);

docs.dhtmlx.com/doku.php?id=dhtm … tor:errors

Hope it will help to find the reason for the problem.

Not helping Alexandra.
The log file is also blank.
I am stuck on this, can you point me to an example/source code where such a thing has been implemented and is functional.

Please see Tree samples in scheduler package. For example this one:

dhtmlxConnector/php/samples/tree/01_basic.html

Alexandra
I did look at the examples and if you see my code is exactly the same as of the examples (the basic one) but still no output.
The peculiar thing is, if in my connector, I replace my TreeConnector with the GridConnector it does give me output but the problem is that output is no good for a tree.

if in my connector, I replace my TreeConnector with the GridConnector it does give me output

Possibly you did not include tree_connector.php library. There is the following snippet in tree/01_basic_connector.php that goes with tree/01_basic.html :

require("…/…/codebase/tree_connector.php");
$tree = new TreeConnector($res);

$tree->render_table(“tasks”,“taskId”,“taskName”,"",“parentId”);