Skip to content

Commit 9cc56b6

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Extract key from tree grid record.
1 parent 0351166 commit 9cc56b6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

projects/igniteui-angular/src/lib/grids/row.directive.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ export class IgxRowDirective implements DoCheck, AfterViewInit, OnDestroy {
629629
const isPinned = this.pinned && !this.disabled;
630630
const indexInData = this.grid.isRowPinningToTop && !isPinned ? this.index - this.grid.pinnedRecordsCount : this.index;
631631
const range = isPinned ? this.grid.pinnedDataView.slice(indexInData, indexInData + rowCount) : this.grid.verticalScrollContainer.igxForOf.slice(indexInData, indexInData + rowCount);
632-
const inRange = range.filter(x => this.selectionService.isRowSelected(this.grid.primaryKey ? (x.recordRef || x)[this.grid.primaryKey] : (x.recordRef || x))).length > 0;
632+
const inRange = range.filter(x => this.selectionService.isRowSelected(this.extractRecordKey(x))).length > 0;
633633
return inRange;
634634
}
635635
return false;
@@ -646,6 +646,18 @@ export class IgxRowDirective implements DoCheck, AfterViewInit, OnDestroy {
646646
return false;
647647
}
648648

649+
protected extractRecordKey(rec: any) {
650+
let recData = rec;
651+
if (this.grid.isRecordMerged(recData)) {
652+
recData = rec.recordRef;
653+
}
654+
655+
if(this.grid.isTreeRow && this.grid.isTreeRow(recData)){
656+
recData = recData.data;
657+
}
658+
return this.grid.primaryKey ? recData[this.grid.primaryKey] : recData;
659+
}
660+
649661
protected getRowHeight() {
650662
const indexInData = this.grid.verticalScrollContainer.igxForOf.indexOf(this.metaData);
651663
const size = this.grid.verticalScrollContainer.getSizeAt(indexInData) - 1;

0 commit comments

Comments
 (0)