diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index c327ccbd3ee..5d414e5c01d 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -2424,11 +2424,11 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable } toggleRow(rowData: any, event?: Event) { - if (!this.dataKey) { - throw new Error('dataKey must be defined to use row expansion'); + if (!this.groupRowsBy) { + throw new Error('groupRowsBy must be defined to use row expansion'); } - let dataKeyValue = String(ObjectUtils.resolveFieldData(rowData, this.dataKey)); + let dataKeyValue = String(ObjectUtils.resolveFieldData(rowData, this.groupRowsBy)); if (this.expandedRowKeys[dataKeyValue] != null) { delete this.expandedRowKeys[dataKeyValue]; @@ -2458,7 +2458,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable } isRowExpanded(rowData: any): boolean { - return this.expandedRowKeys[String(ObjectUtils.resolveFieldData(rowData, this.dataKey))] === true; + return this.expandedRowKeys[String(ObjectUtils.resolveFieldData(rowData, this.groupRowsBy))] === true; } isRowEditing(rowData: any): boolean {