Skip to content

Commit 6031ef5

Browse files
committed
add collectionviewer to disconnect
1 parent 024f14c commit 6031ef5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/demo-app/data-table/person-data-source.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export class PersonDataSource extends DataSource<any> {
5050
});
5151
}
5252

53+
disconnect() {
54+
// No-op
55+
}
56+
5357
updateDisplayData() {
5458
const data = this._peopleDatabase.data.slice();
5559

src/lib/core/data-table/data-source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export interface CollectionViewer {
1414

1515
export abstract class DataSource<T> {
1616
abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;
17-
disconnect() {}
17+
abstract disconnect(collectionViewer: CollectionViewer): void;
1818
}

src/lib/core/data-table/data-table.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class CdkTable<T> implements CollectionViewer {
180180
this._onDestroy.next();
181181
this._onDestroy.complete();
182182
if (this.dataSource) {
183-
this.dataSource.disconnect();
183+
this.dataSource.disconnect(this);
184184
}
185185
}
186186

@@ -236,7 +236,7 @@ export class CdkTable<T> implements CollectionViewer {
236236
this._data = [];
237237

238238
if (this._dataSource) {
239-
this.dataSource.disconnect();
239+
this.dataSource.disconnect(this);
240240
}
241241
this._dataSource = dataSource;
242242

0 commit comments

Comments
 (0)