tablesorter pager initial pagination
Asked Answered
C

4

9

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.

Connell answered 16/6, 2010 at 8:54 Comment(2)
I've never used the paging plugin for tablesorter, but if you don't get a solution, maybe try datatables.netPerennial
thank you for the comment. I've been taking a look at what you sent me and it looks great and quite easy to handle, but for the moment, I'm trying to fix this, because my whole application is using tablesorter pager.Connell
A
27

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

.tablesorterPager({container: $("#pager"), size: 20}); 
Alyosha answered 17/6, 2010 at 15:40 Comment(2)
I tried this, but it seems not to work. Has the keyword 'size' changed?Arcuation
size is also not working for me -- even if I change it in the jquery.tablesorter.pager.js file. I get 10 rows. No matter what.Busywork
D
0

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
}
Downatheel answered 5/9, 2012 at 3:45 Comment(0)
D
-1

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.

Durable answered 1/2, 2018 at 14:2 Comment(2)
Welcome to SO! Even if your answer solves the problem, it is unclear as to why it might help. Please elaborate on what happens if you pass false with this parameter, and explain how it solves the issue.Thereunder
This sounds like something you should add in your answer rather than in a reply to me. Try editting your answer.Thereunder
V
-3
$('document').ready(function(){
   $(".pagesize").val(50);
}
Vaporish answered 13/2, 2014 at 14:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.