i have Output Like this from data.php, iam use https://github.com/dabeng/OrgChart
[
{"title":"306","relationship":"30","name":"HARDWARE & ","parentid":"30"},
{"title":"296","relationship":"476","name":"IT DOCUMENTATION","parentid":"476"},
{"title":"596","relationship":"30","name":"MAGANG MIS DEPARTMENT","parentid":"30"},
{"title":"345","relationship":"30","name":"NETWORK SYSTEM STAFF","parentid":"30"},
{"title":"184","relationship":"476","name":"PROGRAM ANALYST","parentid":"476"},
{"title":"46","relationship":"476","name":"PROGRAMMER","parentid":"476"},
{"title":"476","relationship":"30","name":"SOFTWARE DEVELOPMENT ","parentid":"30"},
{"title":"580","relationship":"30","name":"SYSTEM & NETWORK S","parentid":"30"},
{"title":"604","relationship":"580","name":"SYSTEM & SECURITY ","parentid":"580"},
{"title":"48","relationship":"306","name":"TECHNICAL SUPPORT","parentid":"306"}
]
from this ajax
$('#chart-container').orgchart({
'data' : 'data.php',
'nodeContent': 'title',
'nodeId': 'id',
'exportButton': true,
'exportFilename': 'MyOrgChart'
});
But This Not Working ? thks
replace 'data.php' as an ajax response with json format not a URL. Also, your relationships should be in "1/0" of "111" = "hasParent,hasSibling,hasChildren" not the parentid.
The latest version of plugin orgchart can attach relationship property to the datasource behind the scenes. So you can remove relationship filed in the datasource and use json object to initialize orgchart rather than an array.
$('#chart-container').orgchart({
'data' : jsonObj,
'nodeContent': 'title',
'nodeId': 'id',
'exportButton': true,
'exportFilename': 'MyOrgChart'
});