Add refresh ppaginator method.

This commit is contained in:
Spencer Ofwiti 2021-03-24 12:01:35 +03:00
parent 6896ba0f88
commit 02ef0b3587

View File

@ -40,7 +40,6 @@ export class AccountsComponent implements OnInit {
this.userService.accountsSubject.subscribe(accounts => { this.userService.accountsSubject.subscribe(accounts => {
this.dataSource = new MatTableDataSource<any>(accounts); this.dataSource = new MatTableDataSource<any>(accounts);
this.dataSource.paginator = this.paginator; this.dataSource.paginator = this.paginator;
this.paginator._changePageSize(this.paginator.pageSize);
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
this.accounts = accounts; this.accounts = accounts;
}); });
@ -64,4 +63,12 @@ export class AccountsComponent implements OnInit {
this.dataSource.data = this.accounts.filter(account => account.type === this.accountsType); this.dataSource.data = this.accounts.filter(account => account.type === this.accountsType);
} }
} }
refreshPaginator(): void {
if (!this.dataSource.paginator) {
this.dataSource.paginator = this.paginator;
}
this.paginator._changePageSize(this.paginator.pageSize);
}
} }