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

Data binding

Hi

When using javascript tools of a hierarchical nature such as OrgChart (ejDiagram)
or ejTreeView abd the data is returned from a database query (in jSON format)
the chart or treeview are not displayed if the root object(s) hav a NULL entry
in the ParentId column.

For example if I paste the data directly into the page and remove the null ParentId
the OrgChart displays.  Replace the null ParentID no Orgchart.

Code extract for treeview:

 function DisplayTreeView(data) {
DBS$("#TreeView").ejTreeView({
showCheckBox: true,
fields: { id: "Id", parentId: "ParentId", text: "EntityName", hasChild: "HasChild", expanded: "Expanded", dataSource: data }
});
}

Sample Data:

Root Object
EntityName:"Early Childhood & Sch Ed Group"
Expanded:1
HasChild:1
Id:1
ParentId:null

Child Object
EntityName:"Reform Implementation"
Expanded:0
HasChild:1
Id:101
ParentId:31

Regards

Gary

1 Reply

PR Piramanayagam Ramakrishnan Syncfusion Team June 15, 2016 11:55 AM UTC

Hi Gary, 
 
Thanks for contacting Syncfusion support. 
 
Query1: The treeview is not displayed if the root object(s) has a NULL entry in the ParentId column. 
We are unable to reproduce the reported issue (“The TreeView is not displayed if the root object has null entry in ParentId column”) in TreeView control. TreeView is working properly with given code. 
 
For your reference we have prepared the sample to showcase that TreeView control is working properly with given code in the link: http://jsplayground.syncfusion.com/2a1k3ml4 
 
If you still face the same issue, kindly get back to us with more information or provide sample based on your application along with the replication procedure to reproduce the issue at our end. This would be helpful for us to identify the issue and provide a solution at the earliest.

 
Query2: The OrgChart is not displayed if the root object(s) has a NULL entry in the ParentId column.
Please confirm whether the OrgChart didn’t render, when you set root’s parentId as null. If so, we are unable to reproduce the reported issue at our end. Please check with the below playground link and let us know if you are facing any issues at your end.
 
 
Here is the playground link  
 
Regards,
Piramanayagam R.
 


Loader.
Live Chat Icon For mobile
Up arrow icon