@@ -97,10 +97,10 @@ export class PivotUtil {
97
97
const isExpanded = expansionStates . get ( expansionRowKey ) === undefined ?
98
98
defaultExpandState :
99
99
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 &&
102
102
( ( isExpanded && lvl > 0 ) || ( maxDimLvl == currDimLvl ) ) ) {
103
- let dimData = rec [ field + pivotKeys . rowDimensionSeparator + pivotKeys . records ] ;
103
+ let dimData = recordsData ;
104
104
if ( dim . childLevel ) {
105
105
if ( PivotUtil . getDimensionDepth ( dim ) > 1 ) {
106
106
dimData = this . flattenHierarchy ( dimData , config , dim . childLevel ,
@@ -265,7 +265,8 @@ export class PivotUtil {
265
265
if ( ! child [ pivotKeys . records ] ) {
266
266
continue ;
267
267
}
268
- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] = [ ] ;
268
+ const recordsAccessKey = row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ;
269
+ child [ recordsAccessKey ] = [ ] ;
269
270
const keys = Object . assign ( { } , pivotKeys ) as any ;
270
271
keys [ row . memberName ] = row . memberName ;
271
272
const hierarchyFields2 = PivotUtil
@@ -276,16 +277,14 @@ export class PivotUtil {
276
277
child [ row . memberName ] = sibling [ row . memberName ] ;
277
278
// add children to current level if dimensions have same depth
278
279
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 ] ) ;
283
282
child [ row . memberName ] = sib [ row . memberName ] ;
284
283
}
285
284
}
286
285
} else {
287
286
// otherwise overwrite direct child collection
288
- child [ row . memberName + pivotKeys . rowDimensionSeparator + pivotKeys . records ] = siblingData2 ;
287
+ child [ recordsAccessKey ] = siblingData2 ;
289
288
}
290
289
const sibs = prevRowDims . filter ( x => x . memberName !== prevRowField ) ;
291
290
if ( sibs . length > 0 ) {
0 commit comments