It depends on how you retrieve the information. In the case of an AJAX call, you can do this after receiving the result:
var $pagination = $('#pagination');
var totalValue = 25;
var toShow = 20;
var numOfPage = Math.ceil(totalValue / toShow);
if (numOfPage > 1) {
var totalPages = numOfPage;
var currentPage = $pagination.twbsPagination('getCurrentPage');
$pagination.twbsPagination('destroy');
$pagination.twbsPagination($.extend({}, defaultOpts, {
startPage: currentPage,
totalPages: totalPages
}));
} else {
$pagination.twbsPagination('destroy');
}
UPDATE in this event onPageClick: function (event, page) {}you should assign the next ajax call and if the provided code is successfully placed. Something like that.
onPageClick: function (event, page) {
loadNextValues(page);
}
. , .