You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+67-17Lines changed: 67 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,11 +45,11 @@ $ npm install orgchart
45
45
require('orgchart') will load orgchart plugin onto the jQuery object. The orgchart module itself does not export anything.
46
46
47
47
## [Demos on github pages](https://dabeng.github.io/OrgChart/)
48
-
## [Demos based on nested table](https://codepen.io/collection/AWxGVb/)
49
48
## [Demos based on nested ul](https://codepen.io/collection/nWqvzY)
49
+
## [Demos based on nested table](https://codepen.io/collection/AWxGVb/) (obsolete)
50
50
51
51
### online demos
52
-
-[using ul datasource](https://dabeng.github.io/OrgChart/ul-datasource.html)(this feature comes from [Tobyee's good idea:blush:](https://github.com/dabeng/OrgChart/issues/1))
52
+
-[using ul datasource](https://dabeng.github.io/OrgChart/ul-datasource.html)(this feature comes from [Tobyee's good idea:blush:](https://github.com/dabeng/OrgChart/issues/1))
53
53
54
54
-[using local datasource](https://dabeng.github.io/OrgChart/local-datasource.html)
55
55
@@ -71,7 +71,9 @@ require('orgchart') will load orgchart plugin onto the jQuery object. The orgcha
71
71
72
72
-[I wanna load data on-demand](https://dabeng.github.io/OrgChart/ondemand-loading-data.html)
73
73
74
-
Note: when users use ajaxURL option to build orghchart, they must use json datasource(both local and remote are OK) and set the relationship property of datasource by themselves. All of these staff are used to generate the correct expanding/collapsing arrows for nodes.
**Note:** users use should set the relationship property of datasource by themselves. All of these staff are used to generate the correct expanding/collapsing arrows for nodes.
75
77
76
78
-[I wanna customize the structure of node](https://dabeng.github.io/OrgChart/option-createNode.html)
77
79
@@ -249,10 +251,10 @@ var oc = $('#chartContainerId').orgchart(options);
249
251
<tbody>
250
252
<tr>
251
253
<td>data</td>
252
-
<td>json</td>
254
+
<td>json or jquery object</td>
253
255
<td>yes</td>
254
256
<td></td>
255
-
<td>datasource usded to build out structure of orgchart. It should be a json object.</td>
257
+
<td>datasource usded to build out structure of orgchart. It could be a json object or a jquery object(ul element)</td>
256
258
</tr>
257
259
<tr>
258
260
<td>pan</td>
@@ -303,13 +305,6 @@ var oc = $('#chartContainerId').orgchart(options);
303
305
<td>false</td>
304
306
<td>Once enable this option, users can show/hide left/right sibling nodes respectively by clicking left/right arrow.</td>
305
307
</tr>
306
-
<tr>
307
-
<td>ajaxURL</td>
308
-
<td>json</td>
309
-
<td>no</td>
310
-
<td></td>
311
-
<td>It inclueds four properites -- parent, children, siblings, families(ask for parent node and siblings nodes). As their names imply, different propety provides the URL to which ajax request for different nodes is sent.</td>
312
-
</tr>
313
308
<tr>
314
309
<td>visibleLevel</td>
315
310
<td>positive integer</td>
@@ -456,6 +451,66 @@ Embeds an organization chart in designated container. Accepts an options object
456
451
#### init(newOptions)
457
452
It's the useful way when users want to re-initialize or refresh orgchart based on new options or reload new data.
458
453
454
+
#### addAncestors(data, parentId)
455
+
Adds the ancestors for current orgchart.
456
+
<table>
457
+
<thead>
458
+
<tr>
459
+
<th>Name</th>
460
+
<th>Type</th>
461
+
<th>Required</th>
462
+
<th>Default</th>
463
+
<th>Description</th>
464
+
</tr>
465
+
</thead>
466
+
<tbody>
467
+
<tr>
468
+
<td>data</td>
469
+
<td>json</td>
470
+
<td>yes</td>
471
+
<td></td>
472
+
<td>datasource for building ancestors</td>
473
+
</tr>
474
+
<tr>
475
+
<td>parentId</td>
476
+
<td>string</td>
477
+
<td>yes</td>
478
+
<td></td>
479
+
<td>append current orgchart to the parent node with parentId</td>
480
+
</tr>
481
+
</tbody>
482
+
</table>
483
+
484
+
#### addDescendants(data, $parent)
485
+
Adds the descendants for specified parent node.
486
+
<table>
487
+
<thead>
488
+
<tr>
489
+
<th>Name</th>
490
+
<th>Type</th>
491
+
<th>Required</th>
492
+
<th>Default</th>
493
+
<th>Description</th>
494
+
</tr>
495
+
</thead>
496
+
<tbody>
497
+
<tr>
498
+
<td>data</td>
499
+
<td>array</td>
500
+
<td>yes</td>
501
+
<td></td>
502
+
<td>datasource for building descendants</td>
503
+
</tr>
504
+
<tr>
505
+
<td>$parent</td>
506
+
<td>jquery object</td>
507
+
<td>yes</td>
508
+
<td></td>
509
+
<td>append descendants to the $parent node</td>
510
+
</tr>
511
+
</tbody>
512
+
</table>
513
+
459
514
#### addParent(data)
460
515
Adds parent node(actullay it's always root node) for current orgchart.
461
516
<table>
@@ -898,11 +953,6 @@ This method allow you to export current orgchart as png or pdf file.
898
953
<td>chart</td>
899
954
<td>Initialisation complete event - fired when Organization Chart has been fully initialised and data loaded.</td>
900
955
</tr>
901
-
<tr>
902
-
<td>load-[relation].orgchart</td>
903
-
<td></td>
904
-
<td>This event is fired on a node after the onDemand loading completes.<b>[relation]</b> can be either parent, children or siblings.</td>
0 commit comments