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

Visible page buttons count is off by one at last page #5

Open
hhyyrylainen opened this issue Mar 22, 2021 · 2 comments
Open

Visible page buttons count is off by one at last page #5

hhyyrylainen opened this issue Mar 22, 2021 · 2 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@hhyyrylainen
Copy link

Describe the bug
I noticed when limiting the visible pages to 3, that when I go to the last page, 4 pages are visible.

To Reproduce
Steps to reproduce the behavior:

  1. Make a paginator with a bunch of pages and limit to 3 visible pages
  2. Go to the last page
  3. See that 4 page buttons are visible

Looks like the same issue happens with the visible buttons being set to 5 as well (I just noticed when messing with configuring the visible buttons based on browser window size).

Expected behavior
I expected there to be 3 visible page buttons when at the last page, like there is at the first page.

Screenshots
Everything fine when at the start:
Kuvakaappaus - 2021-03-22 19-52-48

Going to the last page shows this:
Kuvakaappaus - 2021-03-22 19-52-43

Going to page 14 looks correct (page 15 acts like the last page):
Kuvakaappaus - 2021-03-22 19-52-58

Desktop (please complete the following information):

  • Firefox
@villainoustourist villainoustourist added the bug Something isn't working label Mar 22, 2021
@villainoustourist villainoustourist self-assigned this Mar 22, 2021
villainoustourist added a commit that referenced this issue Mar 23, 2021
@villainoustourist villainoustourist added the question Further information is requested label Mar 23, 2021
@villainoustourist
Copy link
Owner

@hhyyrylainen Thank you for the report. While investigating, I've updated the example code at commit 3e4b3e5. Can you provide any more detail? Number of items in this list, etc?

@hhyyrylainen
Copy link
Author

Here's the JSON response for fetching the last page (where this problem is shown):

{
    "lastRowOnPage": 48,
    "firstRowOnPage": 46,
    "rowCount": 48,
    "pageSize": 3,
    "pageCount": 16,
    "currentPage": 16,
    "results": [
        {
            "data": "redacted from here"
        },
        {
            "data": "redacted from here"
        },
        {
            "data": "redacted from here"
        }
    ]
}

I limited the items per page to 3 as I don't otherwise have enough data to get a bunch of pages.

Here's my source code on how I use show this data: https://github.com/Revolutionary-Games/ThriveDevCenter/blob/13f383cf82957abe60f60d3309fccda0e864aa64/Client/Pages/UserList.razor#L27 and this is where the paginator component is used: https://github.com/Revolutionary-Games/ThriveDevCenter/blob/8613beff52ac690d0e6841966f2c43a6b400c73c/Client/Shared/PaginatedTable.razor#L47
I don't think I do anything particularly crazy. I adapt the shown page count based on the browser size.

I tried also with page sizes of (item count per page) 5 and 10, and those also show the same problem.

villainoustourist added a commit that referenced this issue Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants