Hi,
I’m using dhtmlx ver 4.6 and have downloaded the PHP connectors from the link given in the dhtmlx website. I’m unable to populate the tree using the connector. The details of my environment are as follows:
OS: Windows 8.1
Webserver: Apache
PHP version: 5.x
DHTMLX ver: 4.6
Connector Source: dhtmlxConnector_php_v15_120612
Database: Postgresql ver 9.4
My PHP Script for generating the XML for the tree is failing with the output: “”
My PHP Script used for generating the required XML for loading is:
<?php
require("../../libs/connectors/codebase/db_postgre.php");
require("../..//libs/connectors/codebase/tree_connector.php");
$res=pg_pconnect("host=localhost port=5432 db=ednsys user=ednsys password=ednsys");
$gridConn = new TreeConnector($res,'Postgre');
$gridConn->render_table("org_types","org_type_id","org_type_description","","par_org_type");
?>
The file paths in the “require” part of the PHP are all correct.
Find attached the required screenshots so that you get a correct idea. The table structure, the data in the table, my PHP code and the browser screenshots are attached in the slide 1 to slide 4 respectively. I should be getting a nice hierarchy tree of all the departments, instead get the output ".
Do tell me where I’m going wrong.
Thanks and Regards
Manish
Hi,
The connector expects that top level records will have par_org_type as “0”. In your case the top level record (University) just have an empty par_org_type field. Just change that value to “0” and connector will work correctly.
Hi Stanislav,
I’ve performed the necessary action. I added a “root record” with id=0 and also the parent id =0.
It still doesn’t work. See the data changes I’ve made. Kindly suggest a solution.
Thanks much in advance.
Regards
Manish Kumar Deshpande
With such data, as on the last screenshoot, code must work correctly
Please try to enable logs
$gridConn = new TreeConnector($res,‘Postgre’);
$gridConn->enable_log(“some.txt”);
$gridConn->render_table(“org_types”,“org_type_id”,“org_type_description”,"",“par_org_type”);
Log file will contain info about errors ( if you have any ) and exact SQL code executed by the connector.
Hi Stanislav,
The code works fine and the problem was due to some unprintable characters in the PHP file that came in the way. I don’t know how. I’ve re-written the PHP file in a new editor and on execution, it works fine. Thanks for your guidance and support.
Regards
Manish.