diff --git a/README.md b/README.md
index 4b3709e9..b2a56a80 100644
--- a/README.md
+++ b/README.md
@@ -514,9 +514,6 @@ $('#chartContainerId').orgchart(options);
depth | positive integer | no | 999 | It indicates the level that at the very beginning orgchart is expanded to. |
-
- nodeChildren | string | no | "children" | It sets one property of datasource as children nodes collection. |
-
nodeTitle | string | no | "name" | It sets one property of datasource as text content of title section of orgchart node. In fact, users can create a simple orghcart with only nodeTitle option. |
diff --git a/bower.json b/bower.json
index 6267ef96..6043f3aa 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "orgchart",
- "version": "1.1.2",
+ "version": "1.1.3",
"homepage": "https://github.com/dabeng/OrgChart",
"authors": [
"dabeng "
diff --git a/dist/js/jquery.orgchart.js b/dist/js/jquery.orgchart.js
index f24c4c65..ba78d67f 100755
--- a/dist/js/jquery.orgchart.js
+++ b/dist/js/jquery.orgchart.js
@@ -29,7 +29,6 @@
var defaultOptions = {
'nodeTitle': 'name',
'nodeId': 'id',
- 'nodeChildren': 'children',
'toggleSiblingsResp': false,
'depth': 999,
'chartClass': '',
@@ -75,7 +74,7 @@
if (data instanceof $) { // ul datasource
buildHierarchy($chart, buildJsonDS(data.children()), 0, opts);
} else { // local json datasource
- buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00', opts), 0, opts);
+ buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00'), 0, opts);
}
} else {
$.ajax({
@@ -86,7 +85,7 @@
}
})
.done(function(data, textStatus, jqXHR) {
- buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00', opts), 0, opts);
+ buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00'), 0, opts);
})
.fail(function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
@@ -230,12 +229,11 @@
return subObj;
}
- function attachRel(data, flags, opts) {
- var children = data[opts.nodeChildren]
- data.relationship = flags + (children && children.length > 0 ? 1 : 0);
- if (children) {
- children.forEach(function(item) {
- attachRel(item, '1' + (children.length > 1 ? 1 :0), opts);
+ function attachRel(data, flags) {
+ data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);
+ if (data.children) {
+ data.children.forEach(function(item) {
+ attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));
});
}
return data;
@@ -761,7 +759,7 @@
function buildHierarchy ($appendTo, nodeData, level, opts, callback) {
var $table;
// Construct the node
- var $childNodes = nodeData[opts.nodeChildren];
+ var $childNodes = nodeData.children;
var hasChildren = $childNodes ? $childNodes.length : false;
if (Object.keys(nodeData).length > 1) { // if nodeData has nested structure
$table = $('');
diff --git a/examples/js/jquery.orgchart.js b/examples/js/jquery.orgchart.js
index f24c4c65..ba78d67f 100755
--- a/examples/js/jquery.orgchart.js
+++ b/examples/js/jquery.orgchart.js
@@ -29,7 +29,6 @@
var defaultOptions = {
'nodeTitle': 'name',
'nodeId': 'id',
- 'nodeChildren': 'children',
'toggleSiblingsResp': false,
'depth': 999,
'chartClass': '',
@@ -75,7 +74,7 @@
if (data instanceof $) { // ul datasource
buildHierarchy($chart, buildJsonDS(data.children()), 0, opts);
} else { // local json datasource
- buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00', opts), 0, opts);
+ buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00'), 0, opts);
}
} else {
$.ajax({
@@ -86,7 +85,7 @@
}
})
.done(function(data, textStatus, jqXHR) {
- buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00', opts), 0, opts);
+ buildHierarchy($chart, opts.ajaxURL ? data : attachRel(data, '00'), 0, opts);
})
.fail(function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
@@ -230,12 +229,11 @@
return subObj;
}
- function attachRel(data, flags, opts) {
- var children = data[opts.nodeChildren]
- data.relationship = flags + (children && children.length > 0 ? 1 : 0);
- if (children) {
- children.forEach(function(item) {
- attachRel(item, '1' + (children.length > 1 ? 1 :0), opts);
+ function attachRel(data, flags) {
+ data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);
+ if (data.children) {
+ data.children.forEach(function(item) {
+ attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));
});
}
return data;
@@ -761,7 +759,7 @@
function buildHierarchy ($appendTo, nodeData, level, opts, callback) {
var $table;
// Construct the node
- var $childNodes = nodeData[opts.nodeChildren];
+ var $childNodes = nodeData.children;
var hasChildren = $childNodes ? $childNodes.length : false;
if (Object.keys(nodeData).length > 1) { // if nodeData has nested structure
$table = $('');
diff --git a/package.json b/package.json
index 04fe7f86..1885cb2e 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "orgchart",
- "version": "1.1.2",
+ "version": "1.1.3",
"description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
"main": "./dist/js/jquery.orgchart.js",
"style": [