brantwills/Angular-Paging

Is there a way to limit the displayed numbers in pagination?

Closed this issue · 9 comments

for example I have 20 pages. What I want to see first in my page is just 1-5 rather than the usual display 1-5..19 20

something like the traditional pagination design to be more specific.

Hey Ryan,

I don't quite follow what you are asking, do you have a link to an image of the traditional pagination design you are referencing?

If you are interested in just showing pages 1 through 5 and not showing the other pages, you would need to perform some simple math to calculate the correct the total to pass into the directive - But I get the impression you are looking for something else.

I'll keep this issue open until we can get you a solid answer and thanks for checking out the directive!

screenshot from 2015-09-23 12 41 52

the traditional design where it shows 1-5 at first and then there is first and last button. The "dots" attribute would also not be displayed.

Thanks also for the reply!

What append if :
the current page is 4, this will be OK? : < 2 3 4 5 6 >
If the last page & current is 6? : < 2 3 4 5 6

Thanks Ryan, very helpful, I think I see what you are after.

To answer your question, the dots are always visible unless there are to few pages to display.
I've included a sample case below which hides the dots - although does not fully meet your request.
Visually the goal is to allow the user to always view the outer paging limits

It certainly is possible to achieve what you are after however it would require code changes.
I'll mark this as an enhancement for now as others may enjoy a more compact paging scheme


<!-- Example state which hides dots -->
<div paging
  page="3" 
  page-size="10" 
  total="50">
</div> 

No Dot Example

Added granularity to show and hide first and last arrows
See release v2.1.0

Thanks! Happy new year!