【问题标题】:orgchart getOrgChart not a functionorgchart getOrgChart 不是函数
【发布时间】:2016-09-12 22:07:35
【问题描述】:

我正在尝试在我的页面中使用 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,

【问题讨论】:

  • 你能发布一个完整的可验证的例子吗?你确定正在加载 getorgchart.js 吗?
  • 是的,我确定它要么没有被加载,要么无法识别函数名(我什至将 js 文件放在与网页相同的目录中,以便它可以找到该文件,但它还是说找不到函数。
  • 好的,一个完整的例子会有所帮助。
  • @mherzig $("#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'}, ...]});});

标签: javascript jquery charts orgchart


【解决方案1】:

在第二封电子邮件“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 对象。

【讨论】:

  • 这里是正在创建的对象的示例:$("#orgStaffing").getOrgChart({ theme: 'vivian', primaryColumns: ['name', 'division', 'project', 'email'], imageColumn: 'image', gridView: true, datasource: [{ id: 497, parentId: 848, name: 'Maria Lopez', division: 'Inbound', project: 'East', email: 'mlopez@company.com', image: 'mlopez.jpg' }, { id: 570, parentId: 175, name: 'Chad Smith', division: 'Inbound', project: 'East', email: 'csmith@company.com', image: 'csmith.jpg' }
  • 请仔细检查 jquery 是否正在加载ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
猜你喜欢
  • 2012-10-12
  • 1970-01-01
  • 2017-07-02
  • 1970-01-01
  • 2018-02-28
  • 2018-01-30
  • 2015-04-12
  • 1970-01-01
相关资源
最近更新 更多