| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Pager plugin</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-latest.min.js"></script> |
| 9 |
|
| 10 |
|
| 11 |
<link rel="stylesheet" href="css/jq.css"> |
| 12 |
<link href="css/prettify.css" rel="stylesheet"> |
| 13 |
<script src="js/prettify.js"></script> |
| 14 |
<script src="js/docs.js"></script> |
| 15 |
|
| 16 |
|
| 17 |
<link rel="stylesheet" href="../css/theme.blue.css"> |
| 18 |
<script src="../js/jquery.tablesorter.js"></script> |
| 19 |
<script src="../js/jquery.tablesorter.widgets.js"></script> |
| 20 |
|
| 21 |
|
| 22 |
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css"> |
| 23 |
<script src="../addons/pager/jquery.tablesorter.pager.js"></script> |
| 24 |
|
| 25 |
<script id="js">$(function() { |
| 26 |
|
| 27 |
// ********************************** |
| 28 |
// Description of ALL pager options |
| 29 |
// ********************************** |
| 30 |
var pagerOptions = { |
| 31 |
|
| 32 |
// target the pager markup - see the HTML block below |
| 33 |
container: $(".pager"), |
| 34 |
|
| 35 |
// use this url format "http:/mydatabase.com?page={page}&size={size}&{sortList:col}" |
| 36 |
ajaxUrl: null, |
| 37 |
|
| 38 |
// modify the url after all processing has been applied |
| 39 |
customAjaxUrl: function(table, url) { return url; }, |
| 40 |
|
| 41 |
// ajax error callback from $.tablesorter.showError function |
| 42 |
// ajaxError: function( config, xhr, settings, exception ) { return exception; }; |
| 43 |
// returning false will abort the error message |
| 44 |
ajaxError: null, |
| 45 |
|
| 46 |
// add more ajax settings here |
| 47 |
// see http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings |
| 48 |
ajaxObject: { dataType: 'json' }, |
| 49 |
|
| 50 |
// process ajax so that the data object is returned along with the total number of rows |
| 51 |
ajaxProcessing: null, |
| 52 |
|
| 53 |
// Set this option to false if your table data is preloaded into the table, but you are still using ajax |
| 54 |
processAjaxOnInit: true, |
| 55 |
|
| 56 |
// output string - default is '{page}/{totalPages}' |
| 57 |
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} |
| 58 |
// also {page:input} & {startRow:input} will add a modifiable input in place of the value |
| 59 |
// In v2.27.7, this can be set as a function |
| 60 |
// output: function(table, pager) { return 'page ' + pager.startRow + ' - ' + pager.endRow; } |
| 61 |
output: '{startRow:input} – {endRow} / {totalRows} rows', |
| 62 |
|
| 63 |
// apply disabled classname (cssDisabled option) to the pager arrows when the rows |
| 64 |
// are at either extreme is visible; default is true |
| 65 |
updateArrows: true, |
| 66 |
|
| 67 |
// starting page of the pager (zero based index) |
| 68 |
page: 0, |
| 69 |
|
| 70 |
// Number of visible rows - default is 10 |
| 71 |
size: 10, |
| 72 |
|
| 73 |
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js) |
| 74 |
savePages : true, |
| 75 |
|
| 76 |
// Saves tablesorter paging to custom key if defined. |
| 77 |
// Key parameter name used by the $.tablesorter.storage function. |
| 78 |
// Useful if you have multiple tables defined |
| 79 |
storageKey:'tablesorter-pager', |
| 80 |
|
| 81 |
// Reset pager to this page after filtering; set to desired page number (zero-based index), |
| 82 |
// or false to not change page at filter start |
| 83 |
pageReset: 0, |
| 84 |
|
| 85 |
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty |
| 86 |
// table row set to a height to compensate; default is false |
| 87 |
fixedHeight: true, |
| 88 |
|
| 89 |
// remove rows from the table to speed up the sort of large tables. |
| 90 |
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. |
| 91 |
removeRows: false, |
| 92 |
|
| 93 |
// If true, child rows will be counted towards the pager set size |
| 94 |
countChildRows: false, |
| 95 |
|
| 96 |
// css class names of pager arrows |
| 97 |
cssNext: '.next', // next page arrow |
| 98 |
cssPrev: '.prev', // previous page arrow |
| 99 |
cssFirst: '.first', // go to first page arrow |
| 100 |
cssLast: '.last', // go to last page arrow |
| 101 |
cssGoto: '.gotoPage', // select dropdown to allow choosing a page |
| 102 |
|
| 103 |
cssPageDisplay: '.pagedisplay', // location of where the "output" is displayed |
| 104 |
cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option |
| 105 |
|
| 106 |
// class added to arrows when at the extremes (i.e. prev/first arrows are "disabled" when on the first page) |
| 107 |
cssDisabled: 'disabled', // Note there is no period "." in front of this class name |
| 108 |
cssErrorRow: 'tablesorter-errorRow' // ajax error information row |
| 109 |
|
| 110 |
}; |
| 111 |
|
| 112 |
$("table") |
| 113 |
|
| 114 |
// Initialize tablesorter |
| 115 |
// *********************** |
| 116 |
.tablesorter({ |
| 117 |
theme: 'blue', |
| 118 |
widthFixed: true, |
| 119 |
widgets: ['zebra', 'filter'] |
| 120 |
}) |
| 121 |
|
| 122 |
// bind to pager events |
| 123 |
// ********************* |
| 124 |
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) { |
| 125 |
var msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') + |
| 126 |
' page <span class="typ">' + (c.page + 1) + '/' + c.totalPages + '</span>'; |
| 127 |
$('#display') |
| 128 |
.append('<li><span class="str">"' + e.type + msg + '</li>') |
| 129 |
.find('li:first').remove(); |
| 130 |
}) |
| 131 |
|
| 132 |
// initialize the pager plugin |
| 133 |
// **************************** |
| 134 |
.tablesorterPager(pagerOptions); |
| 135 |
|
| 136 |
// Add two new rows using the "addRows" method |
| 137 |
// the "update" method doesn't work here because not all rows are |
| 138 |
// present in the table when the pager is applied ("removeRows" is false) |
| 139 |
// *********************************************************************** |
| 140 |
var r, $row, num = 50, |
| 141 |
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' + |
| 142 |
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>'; |
| 143 |
$('button:contains(Add)').click(function() { |
| 144 |
// add two rows of random data! |
| 145 |
r = row.replace(/\{[gijmr]\}/g, function(m) { |
| 146 |
return { |
| 147 |
'{i}' : num + 1, |
| 148 |
'{j}' : num + 2, |
| 149 |
'{r}' : Math.round(Math.random() * 100), |
| 150 |
'{g}' : Math.random() > 0.5 ? 'male' : 'female', |
| 151 |
'{m}' : Math.random() > 0.5 ? 'Mathematics' : 'Languages' |
| 152 |
}[m]; |
| 153 |
}); |
| 154 |
num = num + 2; |
| 155 |
$row = $(r); |
| 156 |
$('table') |
| 157 |
.find('tbody').append($row) |
| 158 |
.trigger('addRows', [$row]); |
| 159 |
return false; |
| 160 |
}); |
| 161 |
|
| 162 |
// Delete a row |
| 163 |
// ************* |
| 164 |
$('table').delegate('button.remove', 'click' ,function() { |
| 165 |
var t = $('table'); |
| 166 |
// disabling the pager will restore all table rows |
| 167 |
// t.trigger('disablePager'); |
| 168 |
// remove chosen row |
| 169 |
$(this).closest('tr').remove(); |
| 170 |
// restore pager |
| 171 |
// t.trigger('enablePager'); |
| 172 |
t.trigger('update'); |
| 173 |
return false; |
| 174 |
}); |
| 175 |
|
| 176 |
// Destroy pager / Restore pager |
| 177 |
// ************** |
| 178 |
$('button:contains(Destroy)').click(function() { |
| 179 |
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs |
| 180 |
var $t = $(this); |
| 181 |
if (/Destroy/.test( $t.text() )) { |
| 182 |
$('table').trigger('destroyPager'); |
| 183 |
$t.text('Restore Pager'); |
| 184 |
} else { |
| 185 |
$('table').tablesorterPager(pagerOptions); |
| 186 |
$t.text('Destroy Pager'); |
| 187 |
} |
| 188 |
return false; |
| 189 |
}); |
| 190 |
|
| 191 |
// Disable / Enable |
| 192 |
// ************** |
| 193 |
$('.toggle').click(function() { |
| 194 |
var mode = /Disable/.test( $(this).text() ); |
| 195 |
$('table').trigger( (mode ? 'disable' : 'enable') + 'Pager'); |
| 196 |
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager'); |
| 197 |
return false; |
| 198 |
}); |
| 199 |
$('table').bind('pagerChange', function() { |
| 200 |
// pager automatically enables when table is sorted. |
| 201 |
$('.toggle').text('Disable Pager'); |
| 202 |
}); |
| 203 |
|
| 204 |
// clear storage (page & size) |
| 205 |
$('.clear-pager-data').click(function() { |
| 206 |
// clears user set page & size from local storage, so on page |
| 207 |
// reload the page & size resets to the original settings |
| 208 |
$.tablesorter.storage( $('table'), 'tablesorter-pager', '' ); |
| 209 |
}); |
| 210 |
|
| 211 |
// go to page 1 showing 10 rows |
| 212 |
$('.goto').click(function() { |
| 213 |
// triggering "pageAndSize" without parameters will reset the |
| 214 |
// pager to page 1 and the original set size (10 by default) |
| 215 |
// $('table').trigger('pageAndSize') |
| 216 |
$('table').trigger('pageAndSize', [1, 10]); |
| 217 |
}); |
| 218 |
|
| 219 |
});</script> |
| 220 |
<script> |
| 221 |
$(function() { |
| 222 |
$('.clear').click(function() { |
| 223 |
$('#display').html( new Array(6).join('<li> </li>') ); |
| 224 |
}); |
| 225 |
}); |
| 226 |
</script> |
| 227 |
</head> |
| 228 |
<body id="pager-demo"> |
| 229 |
<div id="banner"> |
| 230 |
<h1>table<em>sorter</em></h1> |
| 231 |
<h2>Pager plugin</h2> |
| 232 |
<h3>Flexible client-side table sorting</h3> |
| 233 |
<a href="index.html">Back to documentation</a> |
| 234 |
</div> |
| 235 |
|
| 236 |
<div id="main"> |
| 237 |
|
| 238 |
<p class="tip"> |
| 239 |
<em>NOTE!</em> The following are not part of the original plugin: |
| 240 |
</p> |
| 241 |
<ul> |
| 242 |
<li>In <span class="version updated">v2.28.4</span>, added <code>data-pager-output</code> and <code>data-pager-output-filtered</code> attributes which override the <code>output</code> option when set on the <code>pageDisplay</code> element.</li> |
| 243 |
<li>In <span class="version updated">v2.26.0</span>, a page size of "all" instead of a specific number will be saved and used on reload. Also, ajax interaction will pass a size of "all" which may break current server methods on number of pages to return.</li> |
| 244 |
<li>In <span class="version updated">v2.24.0</span>, a page size select option with a value of "all" will display all rows - not recommended for ajax interactions!</li> |
| 245 |
<li>In <span class="version updated">v2.23.0</span>, the following methods were changed due to issues with unique namespacing. |
| 246 |
<ul> |
| 247 |
<li><code>destroy.pager</code> is now <code>destroyPager</code></li> |
| 248 |
<li><code>disable.pager</code> is now <code>disablePager</code></li> |
| 249 |
<li><code>enable.pager</code> is now <code>enablePager</code></li> |
| 250 |
</ul> |
| 251 |
</li> |
| 252 |
<li>In <span class="version">v2.19.0</span>, added <code>pageAndSize</code> method which allows setting both the pager page & size.</li> |
| 253 |
<li>In <span class="version">v2.17.6</span>, added <code>{startRow:input}</code> and <code>{page:input}</code> variables to the <code>output</code> option.</li> |
| 254 |
<li>This pager plugin can be applied to the original tablesorter, but there is one exception - setting the <code>removeRows</code> option to false will break the sort.</li> |
| 255 |
<li>There have been lots of changes made in version 2.1, please check out the <a href="https://github.com/Mottie/tablesorter/wiki/Changes">change log</a>.</li> |
| 256 |
<li>In <span class="version">v2.11</span>, the <code>savePages</code> option was added to saves the current page size and number (requires storage script).</li> |
| 257 |
</ul> |
| 258 |
|
| 259 |
<h1>Triggered Events <button type="button" class="clear">Clear</button></h1> |
| 260 |
<ul id="display"> |
| 261 |
<li>Pager events will appear here.</li> |
| 262 |
<li> </li> |
| 263 |
<li> </li> |
| 264 |
<li> </li> |
| 265 |
<li> </li> |
| 266 |
</ul> |
| 267 |
|
| 268 |
<h1>Demo</h1> |
| 269 |
<br> |
| 270 |
<button type="button">Add Rows</button> <button type="button" class="toggle">Disable Pager</button> <button type="button">Destroy Pager</button> |
| 271 |
<p><button type="button" class="clear-pager-data">Clear saved pager data</button> <button type="button" class="goto">Set page 1 & size 10</button></p> |
| 272 |
<div class="pager"> |
| 273 |
<img src="../addons/pager/icons/first.png" class="first" alt="First" /> |
| 274 |
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" /> |
| 275 |
|
| 276 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 277 |
<img src="../addons/pager/icons/next.png" class="next" alt="Next" /> |
| 278 |
<img src="../addons/pager/icons/last.png" class="last" alt="Last" /> |
| 279 |
<select class="pagesize" title="Select page size"> |
| 280 |
<option value="10">10</option> |
| 281 |
<option value="20">20</option> |
| 282 |
<option value="30">30</option> |
| 283 |
<option value="all">All Rows</option> |
| 284 |
</select> |
| 285 |
<select class="gotoPage" title="Select page number"></select> |
| 286 |
</div> |
| 287 |
|
| 288 |
<table class="tablesorter"> |
| 289 |
<thead> |
| 290 |
<tr> |
| 291 |
<th>Name</th> |
| 292 |
<th>Major</th> |
| 293 |
<th>Sex</th> |
| 294 |
<th>English</th> |
| 295 |
<th>Japanese</th> |
| 296 |
<th>Calculus</th> |
| 297 |
<th>Geometry</th> |
| 298 |
<th class="remove sorter-false"></th> |
| 299 |
</tr> |
| 300 |
</thead> |
| 301 |
<tfoot> |
| 302 |
<tr> |
| 303 |
<th>Name</th> |
| 304 |
<th>Major</th> |
| 305 |
<th>Sex</th> |
| 306 |
<th>English</th> |
| 307 |
<th>Japanese</th> |
| 308 |
<th>Calculus</th> |
| 309 |
<th>Geometry</th> |
| 310 |
<th></th> |
| 311 |
</tr> |
| 312 |
</tfoot> |
| 313 |
<tbody> |
| 314 |
<tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 315 |
<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 316 |
<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 317 |
<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 318 |
<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 319 |
<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 320 |
<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 321 |
<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 322 |
<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 323 |
<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 324 |
<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 325 |
<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 326 |
<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 327 |
<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 328 |
<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 329 |
<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 330 |
<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 331 |
<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 332 |
<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 333 |
<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 334 |
<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 335 |
<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 336 |
<tr><td>Student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 337 |
<tr><td>Student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 338 |
<tr><td>Student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 339 |
<tr><td>Student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 340 |
<tr><td>Student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 341 |
<tr><td>Student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 342 |
<tr><td>Student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 343 |
<tr><td>Student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 344 |
<tr><td>Student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 345 |
<tr><td>Student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 346 |
<tr><td>Student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 347 |
<tr><td>Student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 348 |
<tr><td>Student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 349 |
<tr><td>Student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 350 |
<tr><td>Student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 351 |
<tr><td>Student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 352 |
<tr><td>Student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 353 |
<tr><td>Student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 354 |
<tr><td>Student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 355 |
<tr><td>Student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 356 |
<tr><td>Student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 357 |
<tr><td>Student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 358 |
<tr><td>Student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 359 |
<tr><td>Student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 360 |
<tr><td>Student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 361 |
<tr><td>Student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 362 |
<tr><td>Student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 363 |
<tr><td>Student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr> |
| 364 |
</tbody> |
| 365 |
</table> |
| 366 |
|
| 367 |
<div class="pager"> |
| 368 |
<img src="../addons/pager/icons/first.png" class="first" alt="First" /> |
| 369 |
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" /> |
| 370 |
|
| 371 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 372 |
<img src="../addons/pager/icons/next.png" class="next" alt="Next" /> |
| 373 |
<img src="../addons/pager/icons/last.png" class="last" alt="Last" /> |
| 374 |
<select class="pagesize" title="Select page size"> |
| 375 |
<option value="10">10</option> |
| 376 |
<option value="20">20</option> |
| 377 |
<option value="30">30</option> |
| 378 |
<option value="all">All Rows</option> |
| 379 |
</select> |
| 380 |
<select class="gotoPage" title="Select page number"></select> |
| 381 |
</div> |
| 382 |
|
| 383 |
<h1>Javascript</h1> |
| 384 |
<div id="javascript"> |
| 385 |
<pre class="prettyprint lang-javascript"></pre> |
| 386 |
</div> |
| 387 |
|
| 388 |
<h1>CSS</h1> |
| 389 |
<div> |
| 390 |
<pre class="prettyprint lang-css">/* pager wrapper, div */ |
| 391 |
.tablesorter-pager { |
| 392 |
padding: 5px; |
| 393 |
} |
| 394 |
/* pager wrapper, in thead/tfoot */ |
| 395 |
td.tablesorter-pager { |
| 396 |
background-color: #e6eeee; |
| 397 |
margin: 0; /* needed for bootstrap .pager gets a 18px bottom margin */ |
| 398 |
} |
| 399 |
/* pager navigation arrows */ |
| 400 |
.tablesorter-pager img { |
| 401 |
vertical-align: middle; |
| 402 |
margin-right: 2px; |
| 403 |
cursor: pointer; |
| 404 |
} |
| 405 |
|
| 406 |
/* pager output text */ |
| 407 |
.tablesorter-pager .pagedisplay { |
| 408 |
padding: 0 5px 0 5px; |
| 409 |
width: 50px; |
| 410 |
text-align: center; |
| 411 |
} |
| 412 |
|
| 413 |
/* pager element reset (needed for bootstrap) */ |
| 414 |
.tablesorter-pager select { |
| 415 |
margin: 0; |
| 416 |
padding: 0; |
| 417 |
} |
| 418 |
|
| 419 |
/*** css used when "updateArrows" option is true ***/ |
| 420 |
/* the pager itself gets a disabled class when the number of rows is less than the size */ |
| 421 |
.tablesorter-pager.disabled { |
| 422 |
display: none; |
| 423 |
} |
| 424 |
/* hide or fade out pager arrows when the first or last row is visible */ |
| 425 |
.tablesorter-pager .disabled { |
| 426 |
/* visibility: hidden */ |
| 427 |
opacity: 0.5; |
| 428 |
filter: alpha(opacity=50); |
| 429 |
cursor: default; |
| 430 |
}</pre> |
| 431 |
</div> |
| 432 |
|
| 433 |
<h1>HTML</h1> |
| 434 |
<div id="html"> |
| 435 |
<pre class="prettyprint lang-html"><table class="tablesorter"> |
| 436 |
<!-- view page source to see the entire table --> |
| 437 |
</table> |
| 438 |
|
| 439 |
<!-- pager --> |
| 440 |
<div id="pager" class="pager"> |
| 441 |
<form> |
| 442 |
<img src="first.png" class="first"/> |
| 443 |
<img src="prev.png" class="prev"/> |
| 444 |
<!-- the "pagedisplay" can be any element, including an input --> |
| 445 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} &ndash; {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 446 |
<img src="next.png" class="next"/> |
| 447 |
<img src="last.png" class="last"/> |
| 448 |
<select class="pagesize"> |
| 449 |
<option value="10">10</option> |
| 450 |
<option value="20">20</option> |
| 451 |
<option value="30">30</option> |
| 452 |
<option value="40">40</option> |
| 453 |
<option value="all">All Rows</option> |
| 454 |
</select> |
| 455 |
</form> |
| 456 |
</div></pre> |
| 457 |
|
| 458 |
</div> |
| 459 |
|
| 460 |
<a id="change-log"></a> |
| 461 |
<h1>Pager Change Log</h1> |
| 462 |
<ul> |
| 463 |
<li>Moved to <a href="https://github.com/Mottie/tablesorter/wiki/Changes">wiki pages</a>.</li> |
| 464 |
</ul> |
| 465 |
|
| 466 |
<div class="next-up"> |
| 467 |
<hr /> |
| 468 |
Next up: <a href="example-pager-ajax.html">Pager plugin - Ajax ››</a> |
| 469 |
</div> |
| 470 |
|
| 471 |
</div> |
| 472 |
|
| 473 |
</body> |
| 474 |
</html> |