GetOrgChart 在IE中展开节点
GetOrgChart Expanding nodes in IE
我在 IE 和 Edge 中遇到问题,节点在当前显示的图表顶部展开。
此行为仅在 IE 和 Edge 中存在,Chrome 和 Firefox 按预期显示图表。
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
已在 2.5.2 版本中修复
此问题是由以下 getOrgChart 函数引起的:
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 解析数组时失败。用以下代码替换函数,它应该可以工作。
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
};
我在 IE 和 Edge 中遇到问题,节点在当前显示的图表顶部展开。
此行为仅在 IE 和 Edge 中存在,Chrome 和 Firefox 按预期显示图表。
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
已在 2.5.2 版本中修复
此问题是由以下 getOrgChart 函数引起的:
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 解析数组时失败。用以下代码替换函数,它应该可以工作。
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
};