Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/bootstrap-paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,17 @@
getPages: function () {

var totalPages = this.totalPages,// get or calculate the total pages via the total records
pageStart = (this.currentPage % this.numberOfPages === 0) ? (parseInt(this.currentPage / this.numberOfPages, 10) - 1) * this.numberOfPages + 1 : parseInt(this.currentPage / this.numberOfPages, 10) * this.numberOfPages + 1,//calculates the start page.
// pageStart = (this.currentPage % this.numberOfPages === 0) ? (parseInt(this.currentPage / this.numberOfPages, 10) - 1) * this.numberOfPages + 1 : parseInt(this.currentPage / this.numberOfPages, 10) * this.numberOfPages + 1,//calculates the start page.
output = [],
i = 0,
counter = 0;

// calculates the start page.
var pageStart = this.currentPage - parseInt(this.numberOfPages / 2);
if(pageStart >= totalPages - this.numberOfPages) {
pageStart = totalPages - this.numberOfPages + 1;
}

pageStart = pageStart < 1 ? 1 : pageStart;//check the range of the page start to see if its less than 1.

for (i = pageStart, counter = 0; counter < this.numberOfPages && i <= totalPages; i = i + 1, counter = counter + 1) {//fill the pages
Expand Down