File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ The data object should have the following structure:
28
28
name: " Father" ,
29
29
class: " overriding-css-class" ,
30
30
textClass: " overriding-css-class" ,
31
+ depthOffset: 1 ,
31
32
marriage: {
32
33
spouse: {
33
34
name: " Mother" ,
Original file line number Diff line number Diff line change @@ -67,6 +67,24 @@ const dTree = {
67
67
class : person . class
68
68
} ;
69
69
70
+ // hide linages to the hidden root node
71
+ if ( parent == root ) {
72
+ node . noParent = true ;
73
+ }
74
+
75
+ // apply depth offset
76
+ for ( var i = 0 ; i < person . depthOffset ; i ++ ) {
77
+ var pushNode = {
78
+ name : '' ,
79
+ id : id ++ ,
80
+ hidden : true ,
81
+ children : [ ] ,
82
+ noParent : node . noParent
83
+ } ;
84
+ parent . children . push ( pushNode ) ;
85
+ parent = pushNode ;
86
+ }
87
+
70
88
// sort children
71
89
dTree . _sortPersons ( person . children , opts ) ;
72
90
@@ -125,10 +143,6 @@ const dTree = {
125
143
reconstructTree ( person , root ) ;
126
144
} ) ;
127
145
128
- _ . forEach ( root . children , function ( child ) {
129
- child . noParent = true ;
130
- } ) ;
131
-
132
146
return {
133
147
root : root ,
134
148
siblings : siblings
You can’t perform that action at this time.
0 commit comments