Skip to content

Commit

Permalink
Limit end index to total item count
Browse files Browse the repository at this point in the history
Previously, the end index could exceed the total item count, potentially causing inconsistencies in the displayed range of items. This change ensures the end index is always within the bounds of the total item count, improving the accuracy of the pagination display.
  • Loading branch information
dlemmermann committed Sep 26, 2024
1 parent 4562afa commit 8e469ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gemsfx/src/main/java/com/dlsc/gemsfx/PagingControls.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public PagingControls() {
int startIndex = (view.getPage() * getPageSize()) + 1;
int endIndex = startIndex + getPageSize() - 1;

endIndex = Math.min(endIndex, getTotalItemCount());

return "Showing items " + startIndex + " to " + endIndex + " of " + getTotalItemCount();
});

Expand Down

0 comments on commit 8e469ab

Please sign in to comment.