Skip to content

Commit df234ef

Browse files
committed
chore(*): Returns data flattener to sorting pipe
1 parent 87ce433 commit df234ef

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5956,7 +5956,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
59565956

59575957
while (searchIndex !== -1) {
59585958
this.lastSearchInfo.matchInfoCache.push({
5959-
row: data,
5959+
row: dataRowRec,
59605960
column: c.field,
59615961
index: occurenceIndex++,
59625962
});

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -365,28 +365,6 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
365365
super.ngAfterContentInit();
366366
}
367367

368-
/**
369-
* @hidden @internal
370-
*/
371-
public setFilteredSortedData(data, pinned: boolean) {
372-
super.setFilteredSortedData(data, pinned);
373-
const flatFilteredSortedData = [];
374-
this.flattenTreeGridRecords(this.filteredSortedData, flatFilteredSortedData);
375-
this.filteredSortedData = flatFilteredSortedData;
376-
}
377-
378-
/**
379-
* @hidden @internal
380-
*/
381-
private flattenTreeGridRecords(records: any[], flatData: any[]) {
382-
if (records && records.length) {
383-
for (const record of records) {
384-
(this.isGhostRecord(record)) ? flatData.push(record.data.recordData) : flatData.push(record.data);
385-
this.flattenTreeGridRecords(record.children, flatData);
386-
}
387-
}
388-
}
389-
390368
private loadChildrenOnRowExpansion(args: IRowToggleEventArgs) {
391369
if (this.loadChildrenOnDemand) {
392370
const parentID = args.rowID;

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.pipes.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,22 @@ export class IgxTreeGridSortingPipe implements PipeTransform {
212212
} else {
213213
result = DataUtil.treeGridSort(hierarchicalData, expressions, sorting);
214214
}
215-
grid.setFilteredSortedData(result, pinned);
215+
216+
const filteredSortedData = [];
217+
this.flattenTreeGridRecords(result, filteredSortedData);
218+
grid.setFilteredSortedData(filteredSortedData, pinned);
216219

217220
return result;
218221
}
222+
223+
private flattenTreeGridRecords(records: ITreeGridRecord[], flatData: any[]) {
224+
if (records && records.length) {
225+
for (const record of records) {
226+
this.gridAPI.grid.isGhostRecord(record) ? flatData.push(record.data.recordData) : flatData.push(record.data);
227+
this.flattenTreeGridRecords(record.children, flatData);
228+
}
229+
}
230+
}
219231
}
220232

221233
/** @hidden */

0 commit comments

Comments
 (0)