最初にすべてのテーブル行を表示している場合は、次のコードを使用して一度に 30 行のみを表示できます。
$(document).ready(function() {
// select the table rows
$table_rows = $('.table-example tbody tr');
var table_row_limit = 30;
var page_table = function(page) {
// calculate the offset and limit values
var offset = (page - 1) * table_row_limit,
limit = page * table_row_limit;
// hide all table rows
$table_rows.hide();
// show only the n rows
$table_rows.slice(offset, limit).show();
}
$('.pagination').jqPagination({
max_page: $table_rows.length / table_row_limit,
paged: page_table
});
// set the initial table state to page 1
page_table(1);
});
表のページネーションの例。
最初にすべての行を表示しない場合は、このコードを適応させて、表示/非表示の代わりに AJAX を使用してシステムから行をフェッチすることができます。