Skip to content

Commit 59b8f43

Browse files
authored
fix(cdk/table): expose rendered rows (#33304)
Exposes the currently rendered rows in the table which can be helpful for querying the data. Fixes #28468.
1 parent 23914be commit 59b8f43

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎goldens/cdk/table/index.api.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ export class CdkTable<T> implements AfterContentInit, AfterContentChecked, Colle
346346
removeHeaderRowDef(headerRowDef: CdkHeaderRowDef): void;
347347
removeRowDef(rowDef: CdkRowDef<T>): void;
348348
protected _renderedRange?: ListRange;
349+
get renderedRows(): readonly RenderRow<T>[];
349350
renderRows(): void;
350351
// (undocumented)
351352
_rowOutlet: DataRowOutlet;

‎src/cdk/table/table.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,11 @@ export class CdkTable<T>
634634
/** Row definition that will only be rendered if there's no data in the table. */
635635
@ContentChild(CdkNoDataRow) _noDataRow!: CdkNoDataRow;
636636

637+
/** Returns the currently-rendered rows in the table. */
638+
get renderedRows(): readonly RenderRow<T>[] {
639+
return this._renderRows;
640+
}
641+
637642
constructor() {
638643
const role = inject(new HostAttributeToken('role'), {optional: true});
639644

0 commit comments

Comments
 (0)