I declare a table with paginator in the following way:
<p-table id="tblRequestResponse" name="tblRequestResponse" [value]="requestResponseSummaries" sortField="dateTime" [sortOrder]="-1" lazyLoadOnInit="true"
[paginator]="true" [pageLinks]="3" [rows]="10" [columns]="cols" selectionMode="single" (onLazyLoad)="loadData($event)" stateStorage="session" stateKey="state-allRequestsandResponses" [lazy]="true" #dt>
<ng-template pTemplate="header" let-columns>.....
In Code when we were using v4 of the PrimeNG controls I could reset which page was in view by doing something like:
this.dataTable.paginate(3);
now in the current version the paginate method seems to have been dropped with no replacement. How can I manually set the page?
You can use first
property to manually change current page.
Paginator can also be controlled via model using a binding to the first property where changes trigger a pagination.
Here is an example of how to achieve that:
updatePageNumber() {
this.first = this.nbRows * (this.pageNumber - 1);
}
See working Stackblitz.