我正在使用getOrgChart,我想知道是否可以有多个根元素。例如,我有两个经理,他们的下属都是员工。我不列出他们的共同经理,而是单独显示这两个经理及其员工。
发布于 2017-01-19 04:11:03
可以,请将parentId设置为null
运行下面的代码片段
var orgchart = new getOrgChart(document.getElementById("people"),{
enableEdit: false,
dataSource: [
{ id: 1, parentId: null, Name: "Ivan"},
{ id: 2, parentId: 1, Name: "Ava Field"},
{ id: 3, parentId: 1, Name: "Evie Johnson"},
{ id: 4, parentId: null, Name: "Amber McKenzie"},
{ id: 5, parentId: 4, Name: "Dragan"},
{ id: 6, parentId: 4, Name: "Petkan"}
]
});html, body {margin: 0px; padding: 0px;height: 100%; overflow: hidden; }
#people {width: 100%;height: 100%; } <link href="http://www.getorgchart.com/GetOrgChart/getorgchart/getorgchart.css" rel="stylesheet"/>
<script src="http://www.getorgchart.com/GetOrgChart/getorgchart/getorgchart.js"></script>
<div id="people"></div>
https://stackoverflow.com/questions/41702313
复制相似问题