Skip to content

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