Page range is being added on both sides of selected page
keeganstreet opened this issue · 7 comments
Steps to reproduce:
<paginate :page-count="10" :margin-pages="0" :page-range="5" />
Click Next 10 times to skip through all pages.
Expected result:
The number of displayed page numbers adheres to the page-range
configuration value. 5 page numbers should be visible at all times.
Actual result
On page 1, 5 pages are displayed.
On page 2, 6 pages are displayed.
On page 3, 7 pages are displayed.
On page 4, 8 pages are displayed.
On page 5, 9 pages are displayed.
On page 6, 9 pages are displayed.
On page 7, 8 pages are displayed.
On page 8, 7 pages are displayed.
On page 9, 6 pages are displayed.
On page 10, 5 pages are displayed.
PR with fix coming shortly.
Hi @keeganstreet . Previously i just use the same way as your PR. But i find maybe it will be little confused when the page-range
is even number.
eg. If the page-range
is 5
, we can add 2 page items on both side of selected page. But if the page-range
is 4
. What it should be? I think it may confused the user.
I'm open to your suggestion. And I'm very happy to discuss this question with you. Thank you very much.
BTW. I have checked your PR. It's very awesome! Example and test cases are both added. I'm really appreciate.
Hey @lokyoung, thanks! Nice work on the component overall!
Maybe we could update the readme to say:
It is recommended to use an odd number, so that the same number of pages are displayed before and after the active page
.
Hi @lokyoung, as my PR currently stands, if a developer specifies an even number for the page-range
parameter, there will be one more page number before the active page than after the current page. I can reverse that if you prefer. I honestly think it would be better to just update the docs to recommend that an odd number is used for this parameter. It looks much nicer when its symmetrical.
HI @keeganstreet , I agree with you. I'll merge your PR and update the documentation. Thanks.
Hi @keeganstreet . I have updated the documentation and publish this modification in v1.8.0
. You can check if it's ok. Anything you feel not appropriate you can just reopen this issue or open another, I'm happy to check the feedback. I must say thank you.
Thanks @lokyoung 👍
Thanks for a good pagination component!