From 37764ec784a5633655c37d8ae2255e1668b729f7 Mon Sep 17 00:00:00 2001 From: Giorgi Cheishvili Date: Tue, 28 Nov 2023 17:27:38 +0400 Subject: [PATCH] fix(platform): clear table rows on data source changes --- libs/platform/src/lib/table/table.component.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/platform/src/lib/table/table.component.ts b/libs/platform/src/lib/table/table.component.ts index 7f9d129601a..76d73d52ee3 100644 --- a/libs/platform/src/lib/table/table.component.ts +++ b/libs/platform/src/lib/table/table.component.ts @@ -1597,6 +1597,15 @@ export class TableComponent /** @hidden */ private _listenToTableRowsPipe(): void { + this._subscriptions.add( + /* + * Reset table when the data source is changed, + * because new data source can have different set of data + */ + this._dataSourceDirective.dataSourceChanged.subscribe(() => { + this._setTableRows([]); + }) + ); this._subscriptions.add( this._dataSourceDirective.items$ .pipe( @@ -1851,7 +1860,7 @@ export class TableComponent /** @hidden */ private _calculateVisibleTableRows(): void { this._tableRowsVisible = this._tableRows.filter((row) => !row.hidden); - + console.log({ visible: this._tableRowsVisible, total: this._tableRows }); if (this._virtualScrollDirective?.virtualScroll) { this._virtualScrollDirective.calculateVirtualScrollRows(); } else {