Skip to content

Commit 4346704

Browse files
committed
fix(pivot-grid): update IgxPivotGridRow
1 parent 175e9d0 commit 4346704

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

projects/igniteui-angular/src/lib/grids/grid-public-row.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { IgxSummaryResult } from './summaries/grid-summary';
66
import { ITreeGridRecord } from './tree-grid/tree-grid.interfaces';
77
import { mergeWith } from 'lodash-es';
88
import { CellType, GridServiceType, GridType, IGridValidationState, RowType, ValidationStatus } from './common/grid.interface';
9+
import { IgxPivotGridComponent } from './pivot-grid/public_api';
10+
import { PivotUtil } from './pivot-grid/pivot-util';
911

1012
abstract class BaseRow implements RowType {
1113
public index: number;
@@ -800,10 +802,10 @@ export class IgxPivotGridRow implements RowType {
800802
/**
801803
* The grid that contains the row.
802804
*/
803-
public grid: GridType;
805+
public grid: IgxPivotGridComponent;
804806
private _data?: any;
805807

806-
constructor(grid: GridType, index: number, data?: any) {
808+
constructor(grid: IgxPivotGridComponent, index: number, data?: any) {
807809
this.grid = grid;
808810
this.index = index;
809811
this._data = data && data.addRow && data.recordRef ? data.recordRef : data;
@@ -834,9 +836,9 @@ export class IgxPivotGridRow implements RowType {
834836
* ```
835837
*/
836838
public get key(): any {
837-
const data = this._data ?? this.grid.dataView[this.index];
838-
const primaryKey = this.grid.primaryKey;
839-
return primaryKey ? data[primaryKey] : data;
839+
const dimension = this.grid.visibleRowDimensions[this.grid.visibleRowDimensions.length - 1];
840+
const recordKey = PivotUtil.getRecordKey(this.data, dimension);
841+
return recordKey ? recordKey : null;
840842
}
841843

842844
/**

0 commit comments

Comments
 (0)