@@ -97,10 +97,10 @@ export class PivotUtil {
9797 const isExpanded = expansionStates . get ( expansionRowKey ) === undefined ?
9898 defaultExpandState :
9999 expansionStates . get ( expansionRowKey ) ;
100- if ( rec [ field + pivotKeys . rowDimensionSeparator + pivotKeys . records ] &&
101- rec [ field + pivotKeys . rowDimensionSeparator + pivotKeys . records ] . length > 0 &&
100+ const recordsData = rec [ field + pivotKeys . rowDimensionSeparator + pivotKeys . records ] ;
101+ if ( recordsData && recordsData . length > 0 &&
102102 ( ( isExpanded && lvl > 0 ) || ( maxDimLvl == currDimLvl ) ) ) {
103- let dimData = rec [ field + pivotKeys . rowDimensionSeparator + pivotKeys . records ] ;
103+ let dimData = recordsData ;
104104 if ( dim . childLevel ) {
105105 if ( PivotUtil . getDimensionDepth ( dim ) > 1 ) {
106106 dimData = this . flattenHierarchy ( dimData , config , dim . childLevel ,
@@ -265,7 +265,8 @@ export class PivotUtil {
265265 if ( ! child [ pivotKeys . records ] ) {
266266 continue ;
267267 }
268- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] = [ ] ;
268+ const recordsAccessKey = row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ;
269+ child [ recordsAccessKey ] = [ ] ;
269270 const keys = Object . assign ( { } , pivotKeys ) as any ;
270271 keys [ row . memberName ] = row . memberName ;
271272 const hierarchyFields2 = PivotUtil
@@ -276,16 +277,14 @@ export class PivotUtil {
276277 child [ row . memberName ] = sibling [ row . memberName ] ;
277278 // add children to current level if dimensions have same depth
278279 for ( const sib of siblingData2 ) {
279- if ( sib [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] ) {
280- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] =
281- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ]
282- . concat ( sib [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] ) ;
280+ if ( sib [ recordsAccessKey ] ) {
281+ child [ recordsAccessKey ] = child [ recordsAccessKey ] . concat ( sib [ recordsAccessKey ] ) ;
283282 child [ row . memberName ] = sib [ row . memberName ] ;
284283 }
285284 }
286285 } else {
287286 // otherwise overwrite direct child collection
288- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] = siblingData2 ;
287+ child [ recordsAccessKey ] = siblingData2 ;
289288 }
290289 const sibs = prevRowDims . filter ( x => x . memberName !== prevRowField ) ;
291290 if ( sibs . length > 0 ) {
0 commit comments