@@ -54,20 +54,22 @@ export class IgxTreeGridHierarchizingPipe implements PipeTransform {
54
54
const result : ITreeGridRecord [ ] = [ ] ;
55
55
const missingParentRecords : ITreeGridRecord [ ] = [ ] ;
56
56
collection . forEach ( row => {
57
+ const ghostRow = row . ghostRec !== undefined ;
57
58
const record : ITreeGridRecord = {
58
- rowID : this . getRowID ( primaryKey , row ) ,
59
+ rowID : ghostRow ? this . getRowID ( primaryKey , row . recordData ) : this . getRowID ( primaryKey , row ) ,
59
60
data : row ,
60
61
children : [ ]
61
62
} ;
62
- const parent = map . get ( row [ foreignKey ] ) ;
63
+ const parent = ghostRow ? map . get ( row . recordData [ foreignKey ] ) : map . get ( row [ foreignKey ] ) ;
63
64
if ( parent ) {
64
65
record . parent = parent ;
65
66
parent . children . push ( record ) ;
66
67
} else {
67
68
missingParentRecords . push ( record ) ;
68
69
}
69
70
70
- map . set ( row [ primaryKey ] , record ) ;
71
+ ghostRow ? map . set ( row . recordData [ primaryKey ] , record ) :
72
+ map . set ( row [ primaryKey ] , record ) ;
71
73
} ) ;
72
74
73
75
missingParentRecords . forEach ( record => {
@@ -90,7 +92,7 @@ export class IgxTreeGridHierarchizingPipe implements PipeTransform {
90
92
const record = collection [ i ] ;
91
93
record . level = indentationLevel ;
92
94
record . expanded = this . gridAPI . get_row_expansion_state ( record ) ;
93
- flatData . push ( record . data ) ;
95
+ this . gridAPI . grid . isGhostRecord ( record . data ) ? flatData . push ( record . data . recordData ) : flatData . push ( record . data ) ;
94
96
95
97
if ( record . children && record . children . length > 0 ) {
96
98
this . setIndentationLevels ( id , record . children , indentationLevel + 1 , flatData ) ;
@@ -363,23 +365,15 @@ export class IgxTreeGridShadowRowsPipe implements PipeTransform {
363
365
364
366
transform ( collection : any [ ] , id : string , pipeTrigger : number ) : any [ ] {
365
367
366
- this . modifyPinnedRecordsIDs ( collection ) ;
368
+ const result = [ ] ;
367
369
368
- return collection ;
369
- }
370
+ collection . forEach ( value => {
371
+ if ( this . gridAPI . grid . isRecordPinned ( value ) ) {
372
+ value = { recordData : value , ghostRec : true } ;
373
+ }
374
+ result . push ( value ) ;
375
+ } ) ;
370
376
371
- private modifyPinnedRecordsIDs ( records : ITreeGridRecord [ ] ) {
372
- if ( records && records . length ) {
373
- records . map ( ( value , idx ) => {
374
- if ( this . gridAPI . grid . isRecordPinned ( value . data ) ) {
375
- // Modify the rowID in order to make a recognizeable shadow row
376
- // value.rowID += "_shadow";
377
- }
378
- if ( value . children ) {
379
- this . modifyPinnedRecordsIDs ( value . children ) ;
380
- }
381
- } ) ;
382
- }
377
+ return result ;
383
378
}
384
-
385
379
}
0 commit comments