We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Treeview with PHP

I'm using Treeview with a PHP application. I was filling the datasource using local data generated via PHP. I want to know how can I use a php ajax call to serve as datasource?
There is no documentation about that. Must I create an oData compatible source? or is it possible to have a simple php script generating JSON data to build the tree?
Any example is very appreciated.
Thank you


3 Replies

PR Piramanayagam Ramakrishnan Syncfusion Team October 3, 2016 12:49 PM UTC

Hi Ahmed, 
Thanks for contacting Syncfusion support. 
We have analyzed your query. We would like to inform you that, TreeView is compatible with local data source and OData service.  
For local data-source binding: 
We can decode the JSON data using json_decode method and assign to TreeView control. Please refer the below code example, 
$Json = json_decode(file_get_contents("Data.json"), true); 
$treeview = new \EJ\TreeView("localData"); 
$fields = new EJ\TreeView\Field(); 
echo $treeview->fields($fields)->render(); 
For your reference, we have prepared the TreeView sample with JSON data in the below link: Sample 
OData Service: 
We can also provide the OData service to TreeView control, please refer the below code example, 
$dataManager = new \EJ\DataManager(); 
$query = new \EJ\Query(); 
$child = new \EJ\TreeView\Field(); 
$treeview = new \EJ\TreeView("remoteData"); 
$fields = new EJ\TreeView\Field(); 
echo $treeview->height("300px")->width("300px")->fields($fields)->render(); 
We have live demo sample for your requirement (TreeView with OData service). Please refer the below link: http://php.syncfusion.com/#Navigation/TreeView/remoteData.php 
Currently we are preparing the document for PHP platform. We will publish the document on or before 31th October 2016. 
Please let us know whether the provided sample is helpful in achieving your requirement. If not, get back to us with more information for us to assist you. 
Piramanayagam R

AL Ahmed Lazreg October 7, 2016 04:36 PM UTC

thank you for your answer. But in your php example, you are using some set of classes that I cannot found in syncfusion source codes (EJ\Datatamanager for example). Where can we find this librarie of php classes?


BP Balamurugan P Syncfusion Team October 10, 2016 11:52 AM UTC

Hi Ahmed, 
You can access the Syncfusion related PHP libraries from  Essential Studio package installed location that is available in your system.  
(installed location)\Syncfusion\Essential Studio\\Samples\PHP => SampleBrowser\EJ 
For example, If you have installed the Essential Studio package within C:\Program Files(x86), then navigate to the below location, C:\Program Files (x86)\Syncfusion\Essential Studio\\Samples\PHP => SampleBrowser\EJ 
Please let us know if you require any further assistance. 


Live Chat Icon For mobile
Up arrow icon