如何在 lib orgChart2 https://github.com/rchockxm/js-orgChart-2中添加子节点
我的代码
Ascedance.FamilyTree = (function() {
function FamilyTree() {
var params = {
.....
}
this.pChart = new OrgChartV2(chartParams);
this.pChart.render();
$('.add-root-child').click(this.addChild);
}
FamilyTree.prototype.addChild = function() {
var node, nodeChildParams;
nodeChildParams = {
options: {
targetName: "orgchart",
subTargetName: "orgnode",
clsName: "org-node"
},
customParams: {
caption: "Frank",
description: "Demo Child Nodes"
}
};
node = new OrgNodeV2(nodeChildParams);
return this.pChart.nodes.add.nodes(node);
};
通过单击按钮添加另一个节点(方法addChild),渲染原始木材很好