From 91a35b26297769a7ffa77e781884426a3abc3d1a Mon Sep 17 00:00:00 2001 From: Nicolas Lurkin Date: Thu, 29 Feb 2024 11:31:08 +0100 Subject: [PATCH] Row expansion should use the groupRowsBy as key instead of the dataKey #13645 --- src/app/components/table/table.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 {