MvcPaging icon indicating copy to clipboard operation
MvcPaging copied to clipboard

MaxNrOfPages behaves oddly at small page counts

Open infocynic opened this issue 10 years ago • 2 comments

I have a PagedList with 8 pages.

If I set .Options(o => o.MaxNrOfPages(3)), and change to page 5, I get this:

[First] 1 2 ... 4 5 6 ... 8 [Last]

On page 4 it looks like: [First] 1 ... 3 4 5 ... 7 8 [Last]

In either case, I expect to get 3 pages, not 6, and it would be nice if the Pager was smart enough in any event to realize that the "..." is skipping exactly one page, in which case it's better to render the page link. I don't need links to page 1 / 2 / 7 /8, that's why I have First and Last links.

infocynic avatar Feb 19 '15 21:02 infocynic

When MaxNrOfPages was introduced we did not have the [First] and [Last] yet. That's why it's behaving this way. Agreed, it isn't very pretty. Are you interested in sending a pull request?

martijnboland avatar Feb 19 '15 21:02 martijnboland

I don't have time this week to get the pull request, but I could look at it next week if my schedule opens up.

On Thu Feb 19 2015 at 4:38:41 PM Martijn Boland [email protected] wrote:

When MaxNrOfPages was introduced we did not have the [First] and [Last] yet. That's why it's behaving this way. Agreed, it isn't very pretty. Are you interested in sending a pull request?

— Reply to this email directly or view it on GitHub https://github.com/martijnboland/MvcPaging/issues/46#issuecomment-75141637 .

infocynic avatar Feb 19 '15 22:02 infocynic