Set page number for p-table don't work

UI Components for Angular
Post Reply
Oleg_prime
Posts: 1
Joined: 24 Nov 2021, 15:41

24 Nov 2021, 15:54

I'm trying to set the page number for <p-table> programmatically, but it doesn't work at all. Only works if I try to reset table, passing 0 to property - [first]. Here example of code:

Code: Select all

      <p-table (onLazyLoad)="onFetch($event)"
               [lazy]="true"
               [lazyLoadOnInit]="false"
               [(selection)]="selectedItems"
               [columns]="columns"
               [currentPageReportTemplate]="pageReportTemplate"
               [showCurrentPageReport]="true"
               [filterDelay]="0"
               [loading]="loading"
               [paginator]="true"
               [resetPageOnSort]="false"
               [rowsPerPageOptions]="rowsPerPage"
               [rows]="rowsPerPage[0]"
               [totalRecords]="itemsCount"
               [value]="items"
               [(first)]="currentPage"
               #table
      </p-table>

Code: Select all

  selectSecondPage(): void {
       this.curretPage = 2;
  }
I event try to do something like this:

Code: Select all

      this.table.first = 2;
      this.table.firstChange.emit(2);
      this.table.onLazyLoad.emit(this.table.createLazyLoadMetadata());
Change page happens, but the table doesn't reflect UI changes in paginator, page number 1 is still there. What did I do wrong? PrimeNG version: 11.4.5

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests