Because of the big amount of data with above 30k entries i decided to create a mat table with paginaton. So its working fine right now with my filter, the only problem i have is that only the first page is showing entries and the page navigation is not working. So if i click on next page, the next page is empty
This is my paginator:
this.persons = data;
this.personsFiltered = new MatTableDataSource(this.persons);
this.personsFiltered.paginator = this.paginator;
FilterChanged(){ //this filter works with a input field to search for a special name
this.personsFiltered = of(this.persons).pipe(
//Name
map( p => (!this.vornameFilter || this.vornameFilter.trim() === '') ? p: p.filter((i: any) => i.vorname?.toLowerCase().includes(this.vornameFilter.toLowerCase()))),
map(p => p.slice(this.paginator?.pageIndex * this.paginator?.pageSize, this.paginator?.pageSize))
)
}
My Table:
<table mat-table [dataSource]="personsFiltered" *ngIf="personsFiltered">
<ng-container matColumnDef="Name">
<th mat-header-cell *matHeaderCellDef > Name </th>
<td mat-cell *matCellDef="let user">
{{user.nachname}}, {{user.vorname}}
</td>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator (click)="FilterChanged()" [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
Why is it not showing also entries on the other pages?