Closed manucnx closed 8 years ago
That's not currently built in.
I try this code.
_paginationOutput: function(currentPage, totalPages) { this.writeDebug('_paginationOutput',arguments); currentPage = parseFloat(currentPage); var output = ''; var nextPage = currentPage + 1; var prevPage = currentPage - 1; // Previous page if( currentPage > 0 ) { output += '
@manucnx Your code helped me a great deal. I set it so that the pagination shows the first 5 pages and then the final page.
However, I have an issue now where if I use the "Next" button and I keep pressing that until I'm past page 5, the next set of pages (6-10, for example) doesn't show up. It still shows << Prev 1 2 3 4 5 400 Next>>
Do you know how to address this?
This is my code for that section (based on what you did):
_paginationOutput: function(currentPage, totalPages) {
this.writeDebug('_paginationOutput',arguments);
currentPage = parseFloat(currentPage);
var output = '';
var nextPage = currentPage + 1;
var prevPage = currentPage - 1;
// Previous page
if( currentPage > 0 ) {
output += '<li class="bh-sl-next-prev" data-page="' + prevPage + '">' + this.settings.prevPage + '</li>';
}
// Add the numbers
for (var p = 0; p < Math.ceil(totalPages); p++) {
var n = p + 1;
if (p >= 5 && p < totalPages - 1) {
continue;
}
else {
//output += '<li class="bh-sl-next-prev" data-page="' + nextPage + '">' + n + '</li>';
if (p === currentPage) {
output += '<li class="bh-sl-current" data-page="' + p + '">' + n + '</li>';
}
else {
output += '<li data-page="' + p + '">' + n + '</li>';
}
}
}
// Next page
if( nextPage < totalPages ) {
output += '<li class="bh-sl-next-prev" data-page="' + nextPage + '">' + this.settings.nextPage + '</li>';
//<li class="bh-sl-next-prev" data-page="' + nextPage + '">' + this.settings.nextPage + '</li>
}
return output;
ex, i want show 1 2 . . . . 10 next>>