【问题标题】:item index start from 1 in next pages in Mat-paginationMat-pagination 下一页的项目索引从 1 开始
【发布时间】:2022-12-17 08:28:24
【问题描述】:

我的 mat-table 有 n 行。我有 mat-paginator。这些项目将显示在每个页面中,索引为 1 到 5。我在第一页需要 1 到 5,下一页索引应该从 6 开始。

<mat-paginator [pageSizeOptions]="[5, 10, 20]"
                 showFirstLastButtons
                 [pageSize]="itemsPerPage"
                 [pageIndex]="currentPage"
                 aria-label="Select page of emailObj elements"
                 >
  </mat-paginator>

这里是stackblitz

【问题讨论】:

    标签: angular-material


    【解决方案1】:
    {{ (index + 1) + (paginator.pageIndex * paginator.pageSize) }}
    

    这解决了我的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-31
      • 2013-01-01
      • 2020-11-15
      • 2021-09-13
      • 2016-12-27
      • 2019-12-20
      • 1970-01-01
      • 2020-08-09
      相关资源
      最近更新 更多