How can I implement material pagination on a table without using MatTableDataSource? Most tutorials and examples I find online recommend the use of MatTableDataSource, but I'm unsure of how to actually utilize it. I am fetching data from a database table to populate my material table.
users: any[] = [];
displayData = [];
dataSource = [];
@ViewChild(MatPaginator) paginator: MatPaginator;
constructor(
private authService: AuthService,
private userService: UserService,
private router: Router,
private httpClient: HttpClient
) {}
ngOnInit(): void {
this._getUsers();
}
private _getUsers() {
this.userService;
this.userService.getUsers().subscribe((data) => {
this.users = data.users;
this.displayData = data.users;
this.dataSource = this.users;
});
<div class="users">
<app-extend-table #usersTable
[header]="header"
[data]="displayData"
[columns]="columns">
</app-extend-table>
<!-- <mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator> -->
</div>