Table: Paginator is not working [TotalRecords prop]
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.
after adding [lazy]="true" in p-table, the paginator show up.
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.