getOrgChart - 多个根元素

getOrgChart - Multiple root elements

我正在使用 getOrgChart,想知道是否可以有多个根元素。例如,我有两位经理,他们下面有其他人。我不想列出他们共同的经理,而是想独立显示这两位经理和他们的员工。

是的,可以,将 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>