Skip to content

Commit f365e33

Browse files
committed
chore(*): Refactors shadow row pipe to be after hierarchizing one
1 parent c298ebc commit f365e33

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
<ng-template igxGridFor let-rowData [igxGridForOf]="data
9999
| treeGridTransaction:id:pipeTrigger
100100
| visibleColumns:hasVisibleColumns
101-
| treeGridShadowRows:id:pipeTrigger
102101
| treeGridHierarchizing:primaryKey:foreignKey:childDataKey:id:pipeTrigger
102+
| treeGridShadowRows:id:pipeTrigger
103103
| treeGridFiltering:filteringExpressionsTree:filterStrategy:advancedFilteringExpressionsTree:id:pipeTrigger:filteringPipeTrigger
104104
| treeGridSorting:sortingExpressions:sortStrategy:id:pipeTrigger
105105
| treeGridFlattening:id:expansionDepth:expansionStates:pipeTrigger

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,20 @@ export class IgxTreeGridHierarchizingPipe implements PipeTransform {
5454
const result: ITreeGridRecord[] = [];
5555
const missingParentRecords: ITreeGridRecord[] = [];
5656
collection.forEach(row => {
57-
const ghostRow = row.ghostRec !== undefined;
5857
const record: ITreeGridRecord = {
59-
rowID: ghostRow ? this.getRowID(primaryKey, row.recordData) : this.getRowID(primaryKey, row),
58+
rowID: this.getRowID(primaryKey, row),
6059
data: row,
6160
children: []
6261
};
63-
const parent = ghostRow ? map.get(row.recordData[foreignKey]) : map.get(row[foreignKey]);
62+
const parent = map.get(row[foreignKey]);
6463
if (parent) {
6564
record.parent = parent;
6665
parent.children.push(record);
6766
} else {
6867
missingParentRecords.push(record);
6968
}
7069

71-
ghostRow ? map.set(row.recordData[primaryKey], record) :
72-
map.set(row[primaryKey], record);
70+
map.set(row[primaryKey], record);
7371
});
7472

7573
missingParentRecords.forEach(record => {
@@ -92,7 +90,7 @@ export class IgxTreeGridHierarchizingPipe implements PipeTransform {
9290
const record = collection[i];
9391
record.level = indentationLevel;
9492
record.expanded = this.gridAPI.get_row_expansion_state(record);
95-
this.gridAPI.grid.isGhostRecord(record.data) ? flatData.push(record.data.recordData) : flatData.push(record.data);
93+
flatData.push(record.data);
9694

9795
if (record.children && record.children.length > 0) {
9896
this.setIndentationLevels(id, record.children, indentationLevel + 1, flatData);
@@ -364,16 +362,18 @@ export class IgxTreeGridShadowRowsPipe implements PipeTransform {
364362
}
365363

366364
transform(collection: any[], id: string, pipeTrigger: number): any[] {
365+
this.designateDisabledRows(collection);
366+
return collection;
367+
}
367368

368-
const result = [];
369-
370-
collection.forEach(value => {
371-
if (this.gridAPI.grid.isRecordPinned(value)) {
372-
value = { recordData: value, ghostRec: true };
369+
private designateDisabledRows(collection: ITreeGridRecord[]) {
370+
collection.forEach(record => {
371+
if (this.gridAPI.grid.isRecordPinned(record.data)) {
372+
record.data = { recordData: record.data, ghostRec: true };
373+
}
374+
if (record.children && record.children.length > 0) {
375+
this.designateDisabledRows(record.children);
373376
}
374-
result.push(value);
375377
});
376-
377-
return result;
378378
}
379379
}

0 commit comments

Comments
 (0)