首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IE中的GetOrgChart扩展节点

IE中的GetOrgChart扩展节点
EN

Stack Overflow用户
提问于 2018-08-10 13:27:59
回答 1查看 93关注 0票数 2

我在IE和Edge中有一个问题,即节点在当前显示的图表上展开。

这种行为只出现在IE和Edge中,Chrome和Firefox按预期显示图表。

代码语言:javascript
复制
var peopleElement = document.getElementById("people");
            var orgChart = new getOrgChart(peopleElement, {

            theme: "monica",
            primaryFields: ["Name", "Title", "Department", "Office", "Email", "Phone", "Mobile"],
            photoFields: ["Image"],
            enableEdit: false,
            enableSearch: true,
            enableMove: true,
            enablePrint: false,
            enableZoomOnNodeDoubleClick: true,
            layout: getOrgChart.MIXED_HIERARCHY_RIGHT_LINKS,
            expandToLevel: 2,
            dataSource: source
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-15 11:16:35

修正了2.5.2版的

此问题是在以下getOrgChart函数中引起的:

代码语言:javascript
复制
getOrgChart.util._5 = function (a) {
  var b = a.getAttribute("transform");
  // Chome/FireFox value: matrix(1,0,0,1,265,100)
  // IE value: matrix(1 0 0 1 265 100)
  b = b.replace("matrix", "").replace("(", "").replace(")", "");
  b = getOrgChart.util._zJ(b);
  b = "[" + b + "]";
  // Chrome/Firefox value: [1,0,0,1,265,100]
  // IE Value: [1 0 0 1 265 100]
  b = JSON.parse(b);
  return b
}

缺少的逗号导致解析数组时JSON失败。用下面的代码替换函数,它应该可以工作。

代码语言:javascript
复制
getOrgChart.util._5 = function (a) {
  var b = a.getAttribute("transform");
  // replace all spaces with commas to ensure compatibility in IE
  b = b.replace("matrix", "").replace("(", "").replace(")", "").replace(/ /g, ",");
  b = getOrgChart.util._zJ(b);
  b = "[" + b + "]";
  b = JSON.parse(b);
  return b
};
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51787651

复制
相关文章

相似问题

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