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 366366 return data ;
367367 } ,
368368 //
369- loopChart : function ( $chart ) {
369+ loopChart : function ( $chart , includeNodeData = false ) {
370370 var that = this ;
371371 var $tr = $chart . find ( 'tr:first' ) ;
372372 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+ }
373379 $tr . siblings ( ':last' ) . children ( ) . each ( function ( ) {
374380 if ( ! subObj . children ) { subObj . children = [ ] ; }
375- subObj . children . push ( that . loopChart ( $ ( this ) ) ) ;
381+ subObj . children . push ( that . loopChart ( $ ( this ) , includeNodeData ) ) ;
376382 } ) ;
377383 return subObj ;
378384 } ,
379385 //
380- getHierarchy : function ( ) {
386+ getHierarchy : function ( includeNodeData = false ) {
381387 if ( typeof this . $chart === 'undefined' ) {
382388 return 'Error: orgchart does not exist'
383389 } else {
396402 }
397403 }
398404 }
399- return this . loopChart ( this . $chart ) ;
405+ return this . loopChart ( this . $chart , includeNodeData ) ;
400406 } ,
401407 // detect the exist/display state of related node
402408 getNodeState : function ( $node , relation ) {
You can’t perform that action at this time.
0 commit comments