Organizational Chart Demo (5)
This example works by generating the JSON orgchart definition on-the-fly by using a PHP scripts that queries a database and buils the tree.
The structure is the same as demo #2, but you can see in this file's source code (line 68) that the orgchart structure is obtained from build-json.php, which is called by the library using AJAX.
How to replicate this demo in your own server:
- Download the HTML file you are looking now (right-click on the link and saveAs/saveLinkAs).
- Select a MySQL database and create a table with this structure and content.
- Download build-json.php (change the .txt extension to .php after downloading).
- Customize build-json.php with your MySQL database access credentials (database, user, password).
- Test that your build-json.php works by invoking it directly from the browser; it should produce something like this.
- You can pass arguments to the PHP script for setting orgchart properties like this call does.
Now you can use a MySQL table editor like PhpMyAdmin or CRUDDER for modifying the data and your web will be updated inmediately!