组织图不是函数

orgchart getOrgChart not a function

本文关键字:函数      更新时间:2023-09-26

我试图在我的页面中使用getOrgChart库,但我的浏览器一直坚持它不是一个函数:

代码如下:

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
   <script src="getorgchart.js"></script>
   <link rel="stylesheet" src="getorgchart.css">
<script type="text/javascript"  src="https://www.google.com/jsapi"></script>
      <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script>
 $("#orgStaffing").getOrgChart({
                                theme: 'vivian',
                                primaryColumns: ['name','division','project','email'],
                                imageColumn: 'image',
                                gridView: true,

在第二封电子邮件'jdoe@company.com'前添加引号

我已尝试复制您的问题

    $("#orgStaffing").getOrgChart(
        {
            theme: 'vivian',
            primaryColumns: ['name','division','project','email'],
            imageColumn: 'image',
            gridView: true,
            dataSource: [ 
                    {id: 1, parentId: null, name: 'John Smith', division: 'Inbound', project: 'West', email: 'jsmith@company.com', image: 'johnsmith.jpg'}, 
                    {id: 2, parentId: 1, name: 'Jane Doe', division: 'Inbound', project: 'West', email: 'jdoe@company.com', image: 'janedoe.jpg'}
            ]
        });
html, body {margin: 0px; padding: 0px;height: 100%; overflow: hidden; }
#people {width: 100%;height: 100%; } 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="http://www.getorgchart.com/GetOrgChart/getorgchart/getorgchart.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.getorgchart.com/GetOrgChart/getorgchart/getorgchart.css">
<div id="orgStaffing"></div>

请确保数据源是有效的JSON对象。