tablesorter pager initial pagination

♀尐吖头ヾ 提交于 2019-12-05 19:22:21

问题


This might sound like a very stupid question to some of you, but I assure you I've been checking through the internet and I haven't had any luck about this. My question is: is it possible to set an initial pagination number in the tablesorter pager plugin? By default it takes the 10 option, but I've tried to put a 5 as the selected option and it loads 10 anyway. If I change it and come back to the 5 it will load as said, 5, but not at the beggining.

Is there any option when loading the tablesorter? My code for the tablesorter is this:

$("#TST").tablesorter({
        headers: { 0: { sorter: false }, 4: { sorter: false }, 5: { sorter: false }, 6: { sorter: false} },
        sortList: [[1, 0], [2, 0], [3, 0]],
        widgets: ['zebra']
    })
  .tablesorterPager({
        container: $("#TSTPager"),
        positionFixed: false //,
        //pagesize: 5 
});

the pagesize attribute I wrote in the tablesorterPager was a test, but it doesn't do what I want it to.


回答1:


In the .tablesorterPager call specify a variable size: example :-

.tablesorterPager({container: $("#pager"), size: 20}); 



回答2:


In jquery.tablesorter.pager.js file it'll be 10 size in your js file so change it to 5 like below in defaults variable block.

this.defaults = {
  size: 5
}



回答3:


I had the same issue with the $.tablesorter.storage at first. Try the savesPages at false

.tablesorterPager({
   container: $(".ts-pager"),

   size: 5,
   savePages : false,
})

Actually, I dig in the javascript source code and find that the pager settings is stored in the tablesorter storage widget.




回答4:


$('document').ready(function(){
   $(".pagesize").val(50);
}


来源:https://stackoverflow.com/questions/3051869/tablesorter-pager-initial-pagination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!