首页 > 解决方案 > 如何在primeng表的paginator-bottom手动设置当前页码?

问题描述

我在 Angular 中使用 PrimeNg 表。我正在尝试手动更改当前页面。

我的问题是我的问题的屏幕截图

我将当前页面设置为 10 ( this.onFetchDestinationsHandler(10);)。数据表是完美的工作(见截图它显示数据为 218 的 91 到 100)。但是分页器显示 1 (paginator-highlight-number 是 1) 但它应该是 10

我该如何手动设置?请有人帮助我。

.html

<p-table
      [value]="destinations"
      [lazy]="true"
      (onLazyLoad)="lazyLoadHandler($event)"
      [paginator]="true"
      [rowHover]="true"
      currentPageReportTemplate=" {{first}} to {{last}} of {{totalRecords}}"
      [showCurrentPageReport]="true"
      [rows]="perPage"
      [totalRecords]="totalRecords"
      [loading]="loading"
      [(selection)]="selectedItems"
      [scrollable]="true"
 >
//table -header
//table-body

</p-table>

.ts 文件

  lazyLoadHandler(event: LazyLoadEvent) {
    const currentPage = event.first / event.rows + 1;

    this.onFetchDestinationsHandler(10); // It means current page is 10,And It works table shows data as 91 to 100 of 218. But in bottom paginator page number is in number 1
//(paginator-highlight-number is 1 .It should be 10 )
  }

标签: angularprimeng

解决方案


推荐阅读