martijnboland / MvcPaging

ASP.NET MVC Paging HTML helper
https://blogs.taiga.nl/martijn/2008/08/27/paging-with-aspnet-mvc/
MIT License
290 stars 144 forks source link

MaxNrOfPages behaves oddly at small page counts #46

Open infocynic opened 9 years ago

infocynic commented 9 years ago

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.

martijnboland commented 9 years ago

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?

infocynic commented 9 years ago

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 notifications@github.com 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 .