@@ -76,7 +76,7 @@ export class IgxSorting implements IGridSortingStrategy {
76
76
grid : GridType = null ,
77
77
groupsRecords : any [ ] = [ ] ,
78
78
fullResult : IGroupByResult = { data : [ ] , metadata : [ ] }
79
- ) : any [ ] {
79
+ ) : IGroupByResult {
80
80
const expressions = state . expressions ;
81
81
const expansion = state . expansion ;
82
82
let i = 0 ;
@@ -117,23 +117,24 @@ export class IgxSorting implements IGridSortingStrategy {
117
117
fullResult . metadata . push ( null ) ;
118
118
if ( level < expressions . length - 1 ) {
119
119
recursiveResult = this . groupDataRecursive ( group , state , level + 1 , groupRow ,
120
- expanded ? metadata : [ ] , grid , groupsRecords , fullResult ) ;
120
+ [ ] , grid , groupsRecords , fullResult ) ;
121
121
if ( expanded ) {
122
- result = result . concat ( recursiveResult ) ;
122
+ result = result . concat ( recursiveResult . data ) ;
123
+ metadata = metadata . concat ( recursiveResult . metadata ) ;
123
124
}
124
125
} else {
125
126
for ( const groupItem of group ) {
126
127
fullResult . metadata . push ( groupRow ) ;
127
128
fullResult . data . push ( groupItem ) ;
128
129
}
129
130
if ( expanded ) {
130
- metadata . push ( ... fullResult . metadata . slice ( fullResult . metadata . length - group . length ) ) ;
131
- result . push ( ... fullResult . data . slice ( fullResult . data . length - group . length ) ) ;
131
+ metadata = metadata . concat ( fullResult . metadata . slice ( fullResult . metadata . length - group . length ) ) ;
132
+ result = result . concat ( fullResult . data . slice ( fullResult . data . length - group . length ) ) ;
132
133
}
133
134
}
134
135
i += group . length ;
135
136
}
136
- return result ;
137
+ return { data : result , metadata } ;
137
138
}
138
139
139
140
/**
@@ -264,8 +265,8 @@ export class IgxGrouping extends IgxSorting implements IGridGroupingStrategy {
264
265
const grouping = this . groupDataRecursive ( data , state , 0 , null , metadata , grid , groupsRecords , fullResult ) ;
265
266
grid ?. groupingPerformedSubject . next ( ) ;
266
267
return {
267
- data : grouping ,
268
- metadata
268
+ data : grouping . data ,
269
+ metadata : grouping . metadata
269
270
} ;
270
271
}
271
272
}
0 commit comments