Rui Xia
Rui Xia

Reputation: 175

how to select all checkbox from tablesorter

This table sorter works perfect for me except when I added pagination plugin, I could only access checkboxs at the current page. Would really appreciate any help.

$("table#sortTableExample")
    .tablesorter({widthFixed: true})
    .tablesorterPager({container: $("#pager"), positionFixed: false });


$('#select-all').live('click', function(){
     var $checkbox = $('.checkbox');
     $checkbox.prop('checked', 'checked');
     $(this).hide();
     $('#unselect-all').show();
});


$('#unselect-all').live('click', function(){
     var $checkbox = $('.checkbox');
     $checkbox.prop('checked', '')
     $(this).hide();
 $('#select-all').show();
});

Upvotes: 1

Views: 2582

Answers (1)

Mottie
Mottie

Reputation: 86453

So, the pager plugin for tablesorter completely removes the unseen rows from the table. The content is stored and sorted from memory making it much faster to sort large tables.

I felt the same as @Purmou in that the original documentation was lacking, so I've added a lot more documentation and demos in my fork of the tablesorter plugin on github.

So, to solve your issue, I've modified the pager plugin to only hide the table rows instead of removing them completely. Set the removeRows option to false as in this demo. The main problem is that large tables will sort much slower. Oh, and you won't need to use live() either.

Upvotes: 3

Related Questions