Home > database >  How to retain the pagination number, after reloading the page
How to retain the pagination number, after reloading the page

Time:02-22

I am using Angular PrimeNG Paginator Component (i.e p-paginator).

The HTML part of the code looks like :

<div >
        <p-paginator [rows]="12" pageLinkSize="6" [alwaysShow]="false" [showCurrentPageReport]="true"
          [totalRecords]="totalRecords" #paginator (onPageChange)="onPageChange($event)"></p-paginator>
      </div>

Here the issue is that, suppose current page is on 6th index, when I am reloading the page, it gets back to 1 (the position of the page is not retaining)

enter image description here

Is there any way, that I can retain the page number even after reloading the page OR make the paginator to get selected at a particular index.

CodePudding user response:

 <p-paginator [rows]="1" [first]="6" [alwaysShow]="false" [showCurrentPageReport]="true"
      [totalRecords]="totalRecords" #paginator (onPageChange)="onPageChange($event)"></p-paginator>
  • Related