简体   繁体   中英

Update max_page in jqpagination

I have 1001 entries to be shown .. I have a dropdown box listing how many entries to be shown per page . (10,20,30,40,50). Initially i show 10 entries per page so the number of pages would be 101 .The text content initially shows page 1 of 101. Now when i change the number of entries to be shown per page to 20 , an javascript function is called and the max_page is set to 51 in tht function and text content is showing page 1 of 51 . Upto this its working fine . Now when i click on the last button , it shows the text content as page 101 of 101 ..instead of page 51 of 51 .. further clicks on it are showing wrong values .

$(document).ready(function()
{
$('.pagination').jqPagination({
link_string : '/?page={page_number}',
max_page    :total_pages,
paged       : paging
});

});


$("#items").change(function(){
$('.pagination').jqPagination({
max_page    : total_pages

});
});

您需要更新最大页面(如下所示),而不是重新实例化插件。

$('.pagination').jqPagination('option', 'max_page', 51)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM