I am using this jQuery table pagination script and I like to add a range instead of all the page numbers.
我正在使用这个jQuery表分页脚本,我喜欢添加一个范围而不是所有的页码。
So instead of [1][2][3][4][5][6][7]
i like something [1][2][3][>][last]
所以不是[1] [2] [3] [4] [5] [6] [7]而是喜欢[1] [2] [3] [>] [last]
function paginateIt() {
$("#pagination-ajax").remove();
$('table#overviewJobs').each(function() {
var currentPage = 0;
var numPerPage = 7;
var $table = $(this);
$table.bind('repaginate', function() {
$table.find('tbody tr').show()
.slice(0,currentPage * numPerPage)
.hide()
.end()
.slice((currentPage + 1) * numPerPage)
.hide()
.end();
});
var numRows = $table.find('tbody tr').length;
//alert("Num of rows "+numRows);
var numPages = Math.ceil(numRows / numPerPage);
var $pager = $('<div id="pagination-ajax"></div>');
if(numRows > numPerPage) {
for (var page = 0; page < numPages; page++) {
$('<span class="page-number">' + (page + 1) + '</span>')
.bind('click', {'newPage': page}, function(event) {
currentPage = event.data['newPage'];
//numPerPage = 7;
$table.trigger('repaginate');
$(this).addClass('active').siblings().removeClass('active');
})
.appendTo($pager).addClass('clickable');
}
$pager.find('span.page-number:first').addClass('active');
$pager.insertAfter($('#pagination-divider'));
} //end if numRows
//
//$('#pagination').html(navigation_html);
$table.trigger('repaginate');
});
};
1 个解决方案
#1
0
You may apply a hack. Find your desired .page-number box index, then remove using gt(), then append another .page-number box as on click it, call next page numbers to append.
你可以申请破解。找到您想要的.page-number框索引,然后使用gt()删除,然后添加另一个.page-number框,点击它,调用下一页编号进行追加。
#1
0
You may apply a hack. Find your desired .page-number box index, then remove using gt(), then append another .page-number box as on click it, call next page numbers to append.
你可以申请破解。找到您想要的.page-number框索引,然后使用gt()删除,然后添加另一个.page-number框,点击它,调用下一页编号进行追加。