首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >getOrgChart -多个根元素

getOrgChart -多个根元素
EN

Stack Overflow用户
提问于 2017-01-18 00:34:44
回答 1查看 777关注 0票数 1

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-19 04:11:03

可以,请将parentId设置为null

运行下面的代码片段

代码语言:javascript
复制
       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"}
				]
        });
代码语言:javascript
复制
html, body {margin: 0px; padding: 0px;height: 100%; overflow: hidden; }
#people {width: 100%;height: 100%; } 
代码语言:javascript
复制
<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>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41702313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档