Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row expansion should use the groupRowsBy as key instead of the dataKey #14906

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 {
Expand Down