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

fix(platform): clear table rows on data source changes #11019

Merged
merged 1 commit into from
Nov 28, 2023
Merged
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
11 changes: 10 additions & 1 deletion libs/platform/src/lib/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,15 @@ export class TableComponent<T = any>

/** @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(
Expand Down Expand Up @@ -1851,7 +1860,7 @@ export class TableComponent<T = any>
/** @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 {
Expand Down
Loading