I am using TwbsPagination plug in for displaying paging in my app. It is working fine when we set the page size while initializing. However, based on the search result, I want t
destroy method not worked for me(1.4.1), by look into the source code i find that there are 2 key point to make it re-instantiate correctly.
above shows part of my code, hope it helps you:
$('.unstyled > li >a').on('click', function (e) {
e.preventDefault();
pagination.data('twbs-pagination.js',null);
loadPage(1,$(e.target).attr('categoryId'));
});
function initilizePagination(totalPages,currentPage,blogCategory){
pagination.twbsPagination({
initiateStartPageClick: false,
totalPages: totalPages,
startPage: currentPage,
onPageClick: function (event, page) {
loadPage(page, blogCategory);
}
});
pagination.twbsPagination({render:currentPage});
}
function loadPage(page,blogCategory) {
$.ajax("url",
{
method: "get",
success: function (data) {
$("#blogListWrapper").html(data);
var ajaxPageCount = $('#ajaxPageCount').val();
var ajaxPageNo = parseInt($('#ajaxPageNo').val());
initilizePagination(ajaxPageCount,ajaxPageNo,blogCategory);
}
}
);
}