File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 366
366
return data ;
367
367
} ,
368
368
//
369
- loopChart : function ( $chart ) {
369
+ loopChart : function ( $chart , includeNodeData = false ) {
370
370
var that = this ;
371
371
var $tr = $chart . find ( 'tr:first' ) ;
372
372
var subObj = { 'id' : $tr . find ( '.node' ) [ 0 ] . id } ;
373
+ if ( includeNodeData ) {
374
+ var $node = $ ( $tr . find ( '.node' ) [ 0 ] )
375
+ $ . each ( $node . data ( 'nodeData' ) , function ( key , value ) {
376
+ subObj [ key ] = value ;
377
+ } ) ;
378
+ }
373
379
$tr . siblings ( ':last' ) . children ( ) . each ( function ( ) {
374
380
if ( ! subObj . children ) { subObj . children = [ ] ; }
375
- subObj . children . push ( that . loopChart ( $ ( this ) ) ) ;
381
+ subObj . children . push ( that . loopChart ( $ ( this ) , includeNodeData ) ) ;
376
382
} ) ;
377
383
return subObj ;
378
384
} ,
379
385
//
380
- getHierarchy : function ( ) {
386
+ getHierarchy : function ( includeNodeData = false ) {
381
387
if ( typeof this . $chart === 'undefined' ) {
382
388
return 'Error: orgchart does not exist'
383
389
} else {
396
402
}
397
403
}
398
404
}
399
- return this . loopChart ( this . $chart ) ;
405
+ return this . loopChart ( this . $chart , includeNodeData ) ;
400
406
} ,
401
407
// detect the exist/display state of related node
402
408
getNodeState : function ( $node , relation ) {
You can’t perform that action at this time.
0 commit comments