2015-09-06 41 views
0

Im使用tablesorter分頁器進行頁面導航(simplePagination插件)。只有在頁面之間導航時將分頁設置爲page1的問題,分頁才能正常工作。例如:我從第1頁到第2頁(假設有10頁有100條記錄,每頁10條),它將散列設置爲#頁2即:http://www.index.html/#page1和#頁3當在第3頁上時等等。如何避免tablesorter分頁器在從一個頁面導航到另一個頁面時在頁面末尾添加散列值-jquery simplePagination插件

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(); 
    } 
}); 

有什麼辦法,當我使用simplePagination插件的頁面之間導航關閉頁面哈希(#第1頁,第2頁#)?

謝謝!

回答

0

this issue,你可以添加一個return falseonPageClick回調方法:

因此,在你的代碼更改回調到這一點:

onPageClick: function (pageNumber) { 
    this.onInit(); 
    return false; 
} 
相關問題