How to limit the number of pagination button.
How to limit the number of pagination button.
Hi, I have my table, this table has 10 pages with 10 rows each page.
But If i configure the pagination he as 10 buttons with 10 rows each page.
I want to limit the number of these buttons in 5 buttons something like this:
<code>
prev. 1. 2. 3. 4. 5. next.
</code>
If i press next once, the buttons should show like this:
<code>
prev. 2. 3. 4. 5. 6. next.
</code>
Or when the button five is the last the button selected and the next button is pressed, paginate make something like this:
<code>
prev. 6. 7. 8. 9. 10. next.
</code>
I'm using this function:
$.fn.DataTable.ext.pager.numbers_length = 5;
But this function create buttons ... (ellipsis) between the interval, but this is weird for the end user.
Best regards
Answers
Maybe one of the Paging plugins will do what you want or help you to write your own.
Kevin
Thanks for you asnwer Kthorngren, I found the solution at other forum. I Will leave the funcion:
/**
* Plug-in offers the same functionality as
simple_numbers
pagination type* (see
pagingType
option) but without ellipses.*
* See example for demonstration.
*
*/
$.fn.DataTable.ext.pager.simple_numbers_no_ellipses = function(page, pages){
var numbers = [];
var buttons = $.fn.DataTable.ext.pager.numbers_length;
var half = Math.floor( buttons / 2 );
};