【问题标题】:getOrgChart - Multiple root elementsgetOrgChart - 多个根元素
【发布时间】:2017-01-17 16:34:43
【问题描述】:

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

【问题讨论】:

    标签: orgchart getorgchart


    【解决方案1】:

    是的,可以,将 parentId 设置为 null

    运行下面的代码sn-p

           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>

    【讨论】:

    • 需要帮助,这里的节点是如何连接的??我们现在使用 pid ,对。但我有 2.5.3 版本,所以不知道。
    • @VR7 你可以使用 slinks 和 clinks,见balkan.app/OrgChartJS/Demos/Slinks
    猜你喜欢
    • 2015-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多