primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Table: Paginator is not working [TotalRecords prop]

Open ZeroSkill830 opened this issue 7 months ago • 1 comments

Describe the bug

If you set a totalRecords value greater than the length of the data, the pagination calculation doesn't work.

The paginator does not correctly display the other pages. It is impossible to use the table with server-side pagination.

Pull Request Link

No response

Reason for not contributing a PR

  • [x] Lack of time
  • [x] Unsure how to implement the fix/feature
  • [x] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/github-rbpxrszq?file=src%2Fapp%2Fapp.component.html

Environment

(it doesn't matter)

Angular version

19.1.3

PrimeNG version

v19

Node version

19.1.2

Browser(s)

No response

Steps to reproduce the behavior

Create a paginated p-table where data.length <= rows < totalRecords. Behavior: pagination is disabled (only page 1 is active).

Expected behavior

Can move to page 2 and up to page number (totalRecords - 1)//rows + 1.

ZeroSkill830 avatar May 26 '25 16:05 ZeroSkill830

after adding [lazy]="true" in p-table, the paginator show up.

clyeungae avatar Jun 07 '25 08:06 clyeungae

after adding [lazy]="true" in p-table, the paginator show up.

This workaround works for fixing the paginator page count when [totalRecords] is greater than the size/length of [value]. However, if [lazy]="true", then the filters will not work. For example, the filters from the basic filters docs.

Claudius10 avatar Jul 29 '25 17:07 Claudius10