Im using a tablesorter pager for page navigation (simplePagination plugin). The pagination works fine only with an issue that it sets the hash value to page1 while navigating between pages. for ex: i go from page 1 to page2 (assuming there are 10 pages with 100 records, 10 per page), it sets the hash to #page2 viz: http://www.index.html/#page1 and #page3 when on 3rd page and so on..
js:
$("#pagination").pagination({
items: items.length,
itemsOnPage: 10,
labelText: 'Showing',
cssStyle: 'light-theme',
onInit: function () {
startItem = ((this.currentPage * this.itemsOnPage) + 1);
endItem = ((startItem - 1) + this.itemsOnPage);
if (endItem > this.items) {
endItem = this.items;
}
$('#pagination').prepend(
'<div class="pagination-addon">' +
'<label class="pagination-label">' + this.labelText + '</label> ' +
'<label class="pagination-start-item">' + startItem + '</label> - ' +
'<label class="pagination-end-item">' + endItem + '</label> of ' +
'<label class="pagination-total-items">' + this.items + '</label>' +
'</div>');
},
onPageClick: function (pageNumber) {
this.onInit();
}
});
Is there any way to turn off the page hash (#page1, #page2) when i navigate between the pages using the simplePagination plugin?
Thanks!
According to this issue, you can add a return false
to the onPageClick
callback method:
So change the callback in your code to this:
onPageClick: function (pageNumber) {
this.onInit();
return false;
}