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

There is a problem with your last page... #364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

There is a problem with your last page... #364

wants to merge 1 commit into from

Conversation

firecentaur
Copy link

if the last page is sent to the server, there are no results listed.. this lists the second last page, so that results can be displayed. Please let me know if you disagree. PS I am using server side pagination

if the last page is sent to the server, there are no results listed.. this lists the second last page, so that results can be displayed. Please let me know if you disagree. PS I am using server side pagination
@michaelbromley
Copy link
Owner

Hi,

I'm not sure I totally understand. So, let's say the server has 123 items, and we list 10 per page. So with the current code:

var totalPages = Math.ceil(collectionLength / rowsPerPage);
                        = Math.ceil(123 / 10)
                        = 13

So we would display links 1 ... 13.

  • Page 1 contains items 1 - 10,
  • page 2 contains 11 - 20
  • and so on.
  • Page 12 (second to last) contains items 111 - 120.

So we need page 13 to list the final 3 items.

Does that make sense, or am I missing something ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants