我在同一個問題擊中過,因爲我總是擔心被儘可能的通用,我做了這個簡單的代碼,讓ID來表,它們在代碼中出現時編號,並將特定的尋呼機應用於每個表。
JS
$(".tablesorter table").each(function(pageTableCount){
// Check if pageTableCount was initialized, and add 1 to its value
pageTableCount !==null ? pageTableCount++ : 1;
// Get the table and add ID with counter
table = $(this);
table.attr("id","table-sorter-"+pageTableCount);
// Does the same with the pager
pager = table.parent().find(".tablesorter-pager");
pager.attr("id","table-sorter-pager-"+pageTableCount);
// Initiate the tablesorter
table.tablesorter()
.tablesorterPager({
container: "#table-sorter-pager-"+pageTableCount
});
});
HTML(BS + FontAwesome)
<div class="table-responsive tablesorter">
<table class="table">
<thead>
<tr>
...
</tr>
</thead>
<tbody>
<tr>
...
</tr>
</tbody>
</table>
<div class="tablesorter-pager">
<a href="#" class="first btn btn-default btn-sm btn-icon"><i class="fa fa-angle-double-left"></i></a>
<a href="#" class="prev btn btn-default btn-sm btn-icon"><i class="fa fa-angle-left"></i></a>
<span class="pagedisplay"></span>
<a href="#" class="next btn btn-default btn-sm btn-icon"><i class="fa fa-angle-right"></i></a>
<a href="#" class="last btn btn-default btn-sm btn-icon"><i class="fa fa-angle-double-right"></i></a>
</div><!-- tablesorter-pager -->
</div><!-- .table-responsive -->
希望它能幫助。
請提供[JSFiddle](http://jsfiddle.net),顯示您的問題的示例。 –