Connector and Excel File

Hello,

I am trying to populate a dhtmlx-Tree with hierarchical data from an xls-file.

My test html test file:

[code]

[/code]

My connector.php file:

<?php     
//files from libExcel package
require_once("/dhtmlxTree/dhtmlxConnector/phpExcel/PHPExcel.php");
require_once("/dhtmlxTree/dhtmlxConnector/phpExcel/PHPExcel/IOFactory.php");

 
//connectors
require("/dhtmlxTree/dhtmlxConnector/codebase/db_excel.php");
require("/dhtmlxTree/dhtmlxConnector/codebase/tree_connector.php");


$tree = new TreeConnector("test.xls", "ExcelDBDataWrapper");
$tree->render_table("*", "nid", "A,B");

?>

My xls consists of two colums (A and B), A containing the ID (nid).

The page loads correctly but the tree is not build. Sorry for the basic questions, but I don’t manage to retrieve the data from the xls.

Any hints and help is appreciated!

Try to load connector.php directly in browser.
It will show info about php errors if you have any. ( the client side code looks fine )

Thank you, Stanislav.

I tried that already. It returns a blank page.

I also added

<script type="text/javascript" src="/dhtmlxTree/dhtmlxConnector/codebase/connector.js"></script>

to the client side without improvement.

You have some php level error, and in same time you have php error output disabled.
You can find the actual error info in web server logs, or you can enable php error output and try to load the connector.php in browser once more, to see details about the problem.

Thank you that was useful!
I looked into the log file an found some path errors for the require-part. Including require_once(dirname(__FILE__) . "/dhtmlxTree/dhtmlxConnector/phpExcel/PHPExcel.php"); fixed that.

Unfortunately, this was not the only fault. The log file now contains and the tree is still not working:

PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Not implemented’ in /xxx/dhtmlxTree/dhtmlxConnector/codebase/db_common.php:928
Stack trace:
#0 /xxx/dhtmlxTree/dhtmlxConnector/codebase/base_connector.php(403): DBDataWrapper->fields_list(’’)
#1 /xxx/dhtmlxTree/dhtmlxConnector/codebase/base_connector.php(397): Connector->configure(’
’, ‘id’, false, false, false)
#2 /xxx/connector.php(11): Connector->render_table(’*’, ‘id’)
#3 {main}
thrown in /xxx/dhtmlxTree/dhtmlxConnector/codebase/db_common.php on line 928

For easier comparison (and to be sure that the data format is correct) I use a new excel file now, including the example data from your site:

0 root prop2 prop3
1 child-1.1 prop2 prop3 0
2 child-1.2 prop2 prop3 0
3 child-1.3 prop2 prop3 0
4 child-1.2.1 prop2 prop3 2
5 child-1.2.2 prop2 prop3 2

I have discussed this issue, and it seems that data loading from excel was purposed for plain datasets only. Connector can’t build hierarchical dataset from the excel file.

Sorry for inconvenience.

Oh, bad news, but thanking you for your response.

The users will upload an excel file containing a dataset with the hierarchical information. Its like a list of soccer players and coaches. Each person has a unique id and a field where the id is stored who is the coach. The coaches are on a higher level with all their players beneath.

What would you suggest to implement this tree? Importing to Mysql and reading from there?

Thank you once again.

PHPExcel library gives you access to the data of excel file
phpexcel.codeplex.com/

So, it will require more coding, but it possible to get the data from excel code and form the data for the grid manually. If you need only to read from excell - it must not be very complicated.

  • get data from excell
  • build xml string
  • output that string

dhtmlx.com/docs/products/doc … lTree.html