1

I am trying to add view all option to the

pagesize option

Something silmilar to below:

<select class="pagesize">
<option value="10">10 per page</option>
<option value="20">20 per page</option>
<option value="all">View All</option>
</select>

for JQuery tablesorter. How is that possible? Please share some example or tutorial. Thanks,

zaman
  • 21
  • 2
  • 6

1 Answers1

2

Since you control the pagesize selector, just add a really large value in the view all option:

<select class="pagesize">
  <option value="10">10 per page</option>
  <option value="20">20 per page</option>
  <option value="500">View All</option>
</select>

I tried it and it works without causing any errors, but if you want to be more specific, you can add a bit of code to make it more exact:

$(function(){
  var rows = $('table.tablesorter')[0].config.totalRows;
  $('select.pagesize').find('option:contains("All")').val(rows);
});
Mottie
  • 84,355
  • 30
  • 126
  • 241
  • thanks fudgey for your wonderful esponse. I want to choose your second option. It works fine with the Jquery example but when I add the function to my JSP code and try to VIEW ALL, the script stops working. Any clue? – zaman Mar 20 '12 at 19:18
  • fudgey, I resolved the issue. It was a case issue. Thanks again. – zaman Mar 20 '12 at 20:58