Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: Flawed example in paginator documentation #16308

Closed
Wendelstein7 opened this issue Aug 29, 2024 · 1 comment · Fixed by #16309 · May be fixed by Rodolphe33/gestion-personnel#33
Closed

Table: Flawed example in paginator documentation #16308

Wendelstein7 opened this issue Aug 29, 2024 · 1 comment · Fixed by #16309 · May be fixed by Rodolphe33/gestion-personnel#33
Labels
Component: Documentation Issue or pull request is related to Documentation
Milestone

Comments

@Wendelstein7
Copy link
Contributor

Wendelstein7 commented Aug 29, 2024

This issue is created to accompany a pull request fixing the bug.

Describe the bug

The example code for programmatically paginating trough tables, in the isLastPage() function, is flawed because it only works correctly when the amount of items in the table is an exact multiple of the rows per page count.

The issue can be fixed by replacing

return this.customers ? this.first === this.customers.length - this.rows : true;

with

return this.customers ? this.first + this.rows >= this.customers.length : true;

Environment

  • PrimeNG v17.18.9
  • Angular v18.1.0
  • NodeJS v22.6.0

Reproducer

No response

Angular version

18.1.0

PrimeNG version

17.18.9

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

22.6.0

Browser(s)

No response

Steps to reproduce the behavior

Implement the example provided on [https://primeng.org/table#paginator], and make sure that the count of items (customers in the example) is not a multiple of the row size. This will result in the isLastPage() never returning true.

Expected behavior

The isLastPage() should return true when on the last page of a paginated table.

@Wendelstein7 Wendelstein7 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 29, 2024
@Wendelstein7
Copy link
Contributor Author

I submitted the pull request fixing this issue.

@mehmetcetin01140 mehmetcetin01140 added Component: Documentation Issue or pull request is related to Documentation and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 10, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.18.10 milestone Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Issue or pull request is related to Documentation
Projects
None yet
2 participants