| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Pager Widget</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-latest.min.js"></script> |
| 9 |
|
| 10 |
|
| 11 |
<link href="css/jq.css" rel="stylesheet"> |
| 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 href="../css/theme.blue.css" rel="stylesheet"> |
| 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="../js/widgets/widget-pager.js"></script> |
| 24 |
|
| 25 |
<script id="js">$(function() { |
| 26 |
|
| 27 |
var $table = $('table'); |
| 28 |
|
| 29 |
$table |
| 30 |
|
| 31 |
// Initialize tablesorter |
| 32 |
// *********************** |
| 33 |
.tablesorter({ |
| 34 |
theme: 'blue', |
| 35 |
widthFixed: true, |
| 36 |
widgets: ['zebra', 'filter', 'pager'], |
| 37 |
|
| 38 |
widgetOptions: { |
| 39 |
|
| 40 |
// ** NOTE: All default ajax options have been removed from this demo, |
| 41 |
// see the example-widget-pager-ajax demo for a full list of pager |
| 42 |
// options |
| 43 |
|
| 44 |
// css class names that are added |
| 45 |
pager_css: { |
| 46 |
container : 'tablesorter-pager', // class added to make included pager.css file work |
| 47 |
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning); styled in theme file |
| 48 |
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page) |
| 49 |
}, |
| 50 |
|
| 51 |
// jQuery selectors |
| 52 |
pager_selectors: { |
| 53 |
container : '.pager', // target the pager markup (wrapper) |
| 54 |
first : '.first', // go to first page arrow |
| 55 |
prev : '.prev', // previous page arrow |
| 56 |
next : '.next', // next page arrow |
| 57 |
last : '.last', // go to last page arrow |
| 58 |
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page |
| 59 |
pageDisplay : '.pagedisplay', // location of where the "output" is displayed |
| 60 |
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option |
| 61 |
}, |
| 62 |
|
| 63 |
// output default: '{page}/{totalPages}' |
| 64 |
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} |
| 65 |
// also {page:input} & {startRow:input} will add a modifiable input in place of the value |
| 66 |
pager_output: '{startRow:input} – {endRow} / {totalRows} rows', // '{page}/{totalPages}' |
| 67 |
|
| 68 |
// apply disabled classname to the pager arrows when the rows at either extreme is visible |
| 69 |
pager_updateArrows: true, |
| 70 |
|
| 71 |
// starting page of the pager (zero based index) |
| 72 |
pager_startPage: 0, |
| 73 |
|
| 74 |
// Reset pager to this page after filtering; set to desired page number |
| 75 |
// (zero-based index), or false to not change page at filter start |
| 76 |
pager_pageReset: 0, |
| 77 |
|
| 78 |
// Number of visible rows |
| 79 |
pager_size: 10, |
| 80 |
|
| 81 |
// f true, child rows will be counted towards the pager set size |
| 82 |
pager_countChildRows: false, |
| 83 |
|
| 84 |
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js) |
| 85 |
pager_savePages: true, |
| 86 |
|
| 87 |
// Saves tablesorter paging to custom key if defined. Key parameter name |
| 88 |
// used by the $.tablesorter.storage function. Useful if you have |
| 89 |
// multiple tables defined |
| 90 |
pager_storageKey: "tablesorter-pager", |
| 91 |
|
| 92 |
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty |
| 93 |
// table row set to a height to compensate; default is false |
| 94 |
pager_fixedHeight: true, |
| 95 |
|
| 96 |
// remove rows from the table to speed up the sort of large tables. |
| 97 |
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. |
| 98 |
pager_removeRows: false // removing rows in larger tables speeds up the sort |
| 99 |
|
| 100 |
} |
| 101 |
|
| 102 |
}) |
| 103 |
|
| 104 |
// bind to pager events |
| 105 |
// ********************* |
| 106 |
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) { |
| 107 |
var p = c.pager, // NEW with the widget... it returns config, instead of config.pager |
| 108 |
msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') + |
| 109 |
' page <span class="typ">' + (p.page + 1) + '/' + p.totalPages + '</span>'; |
| 110 |
$('#display') |
| 111 |
.append('<li><span class="str">"' + e.type + msg + '</li>') |
| 112 |
.find('li:first').remove(); |
| 113 |
}) |
| 114 |
|
| 115 |
// Add two new rows using the "addRows" method |
| 116 |
// the "update" method doesn't work here because not all rows are |
| 117 |
// present in the table when the pager is applied ("removeRows" is false) |
| 118 |
// *********************************************************************** |
| 119 |
var r, $row, num = 50, |
| 120 |
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>' + |
| 121 |
'<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>'; |
| 122 |
$('button:contains(Add)').click(function() { |
| 123 |
// add two rows of random data! |
| 124 |
r = row.replace(/\{[gijmr]\}/g, function(m) { |
| 125 |
return { |
| 126 |
'{i}' : num + 1, |
| 127 |
'{j}' : num + 2, |
| 128 |
'{r}' : Math.round(Math.random() * 100), |
| 129 |
'{g}' : Math.random() > 0.5 ? 'male' : 'female', |
| 130 |
'{m}' : Math.random() > 0.5 ? 'Mathematics' : 'Languages' |
| 131 |
}[m]; |
| 132 |
}); |
| 133 |
num = num + 2; |
| 134 |
$row = $(r); |
| 135 |
$table |
| 136 |
.find('tbody').append($row) |
| 137 |
.trigger('addRows', [$row]); |
| 138 |
return false; |
| 139 |
}); |
| 140 |
|
| 141 |
// Delete a row |
| 142 |
// ************* |
| 143 |
$table.delegate('button.remove', 'click' ,function() { |
| 144 |
// disabling the pager will restore all table rows |
| 145 |
// $table.trigger('disablePager'); |
| 146 |
// remove chosen row |
| 147 |
$(this).closest('tr').remove(); |
| 148 |
// restore pager |
| 149 |
// $table.trigger('enablePager'); |
| 150 |
$table.trigger('update'); |
| 151 |
return false; |
| 152 |
}); |
| 153 |
|
| 154 |
// Destroy pager / Restore pager |
| 155 |
// ************** |
| 156 |
$('button:contains(Destroy)').click(function() { |
| 157 |
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs |
| 158 |
var $t = $(this); |
| 159 |
if (/Destroy/.test( $t.text() )) { |
| 160 |
$table.trigger('destroyPager'); |
| 161 |
$t.text('Restore Pager'); |
| 162 |
} else { |
| 163 |
$('table').trigger('applyWidgetId', 'pager'); |
| 164 |
$t.text('Destroy Pager'); |
| 165 |
} |
| 166 |
return false; |
| 167 |
}); |
| 168 |
|
| 169 |
// Disable / Enable |
| 170 |
// ************** |
| 171 |
$('.toggle').click(function() { |
| 172 |
var mode = /Disable/.test( $(this).text() ); |
| 173 |
// using disablePager or enablePager |
| 174 |
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager'); |
| 175 |
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager'); |
| 176 |
return false; |
| 177 |
}); |
| 178 |
$table.bind('pagerChange', function() { |
| 179 |
// pager automatically enables when table is sorted. |
| 180 |
$('.toggle').text('Disable Pager'); |
| 181 |
}); |
| 182 |
|
| 183 |
// clear storage (page & size) |
| 184 |
$('.clear-pager-data').click(function() { |
| 185 |
// clears user set page & size from local storage, so on page |
| 186 |
// reload the page & size resets to the original settings |
| 187 |
$.tablesorter.storage( $table, 'tablesorter-pager', '' ); |
| 188 |
}); |
| 189 |
|
| 190 |
// go to page 1 showing 10 rows |
| 191 |
$('.goto').click(function() { |
| 192 |
// triggering "pageAndSize" without parameters will reset the |
| 193 |
// pager to page 1 and the original set size (10 by default) |
| 194 |
// $('table').trigger('pageAndSize') |
| 195 |
$table.trigger('pageAndSize', [1, 10]); |
| 196 |
}); |
| 197 |
|
| 198 |
});</script> |
| 199 |
</head> |
| 200 |
<body id="pager-demo"> |
| 201 |
<div id="banner"> |
| 202 |
<h1>table<em>sorter</em></h1> |
| 203 |
<h2>Pager Widget</h2> |
| 204 |
<h3>Flexible client-side table sorting</h3> |
| 205 |
<a href="index.html">Back to documentation</a> |
| 206 |
</div> |
| 207 |
|
| 208 |
<div id="main"> |
| 209 |
|
| 210 |
<p class="tip"> |
| 211 |
<em>NOTE!</em> |
| 212 |
</p> |
| 213 |
<ul> |
| 214 |
<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> |
| 215 |
<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> |
| 216 |
<li>In <span class="version updated">v2.25.4</span>, updated example to use <code>applyWidgetId</code> to re-apply the pager widget after being destroyed.</li> |
| 217 |
<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> |
| 218 |
<li>In <span class="version">v2.19.0</span>, added <code>pageAndSize</code> method which allows setting both the pager page & size.</li> |
| 219 |
<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.<p></p></li> |
| 220 |
|
| 221 |
<li>This pager WIDGET <em>can not</em> be applied to the original tablesorter.</li> |
| 222 |
<li>Do not use this widget along with the pager plugin.</li> |
| 223 |
<li>The pager.css file also works with this pager widget.</li> |
| 224 |
<li>This widget is still in <span class="beta">development</span> as it has not been throughly tested.</li> |
| 225 |
<li>Extensive documentation has not been included, as all functioning is essentially identical to the pager addon, but here are some important differences: |
| 226 |
<ul> |
| 227 |
<li>All of the options are now set within the <code>widgetOptions</code>.</li> |
| 228 |
<li>Pager events (pagerChange pagerComplete pagerInitialized pageMoved) now return <code>table.config</code> instead of <code>table.config.pager</code>.</li> |
| 229 |
<li>Most option names have only been modified by adding <code>pager_</code> as a prefix.</li> |
| 230 |
<li>Exceptions include moving all applied css class names into a <code>pager_css</code> option and all selectors into <code>pager_selectors</code>, including the original <code>container</code> option.</li> |
| 231 |
<li>Because I stopped trying so hard to make widgets compatible with jQuery v1.2.6, this widget requires at least v1.3+.</li> |
| 232 |
<li>See the Javascript code below for a full example.</li> |
| 233 |
</ul> |
| 234 |
</li> |
| 235 |
</ul> |
| 236 |
|
| 237 |
<h1>Triggered Events</h1> |
| 238 |
<ul id="display"> |
| 239 |
<li>Pager events will appear here.</li> |
| 240 |
<li> </li> |
| 241 |
<li> </li> |
| 242 |
</ul> |
| 243 |
|
| 244 |
<h1>Demo</h1> |
| 245 |
<br> |
| 246 |
<button type="button">Add Rows</button> <button type="button" class="toggle">Disable Pager</button> <button type="button">Destroy Pager</button> |
| 247 |
<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> |
| 248 |
<div class="pager"> |
| 249 |
<img src="../addons/pager/icons/first.png" class="first" alt="First" /> |
| 250 |
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" /> |
| 251 |
|
| 252 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 253 |
<img src="../addons/pager/icons/next.png" class="next" alt="Next" /> |
| 254 |
<img src="../addons/pager/icons/last.png" class="last" alt="Last" /> |
| 255 |
<select class="pagesize" title="Select page size"> |
| 256 |
<option value="10">10</option> |
| 257 |
<option value="20">20</option> |
| 258 |
<option value="30">30</option> |
| 259 |
<option value="all">All Rows</option> |
| 260 |
</select> |
| 261 |
<select class="gotoPage" title="Select page number"></select> |
| 262 |
</div> |
| 263 |
|
| 264 |
<table class="tablesorter"> |
| 265 |
<thead> |
| 266 |
<tr> |
| 267 |
<th>Name</th> |
| 268 |
<th>Major</th> |
| 269 |
<th>Sex</th> |
| 270 |
<th>English</th> |
| 271 |
<th>Japanese</th> |
| 272 |
<th>Calculus</th> |
| 273 |
<th>Geometry</th> |
| 274 |
<th class="remove sorter-false"></th> |
| 275 |
</tr> |
| 276 |
</thead> |
| 277 |
<tfoot> |
| 278 |
<tr> |
| 279 |
<th>Name</th> |
| 280 |
<th>Major</th> |
| 281 |
<th>Sex</th> |
| 282 |
<th>English</th> |
| 283 |
<th>Japanese</th> |
| 284 |
<th>Calculus</th> |
| 285 |
<th>Geometry</th> |
| 286 |
<th></th> |
| 287 |
</tr> |
| 288 |
</tfoot> |
| 289 |
<tbody> |
| 290 |
<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> |
| 291 |
<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> |
| 292 |
<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> |
| 293 |
<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> |
| 294 |
<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> |
| 295 |
<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> |
| 296 |
<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> |
| 297 |
<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> |
| 298 |
<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> |
| 299 |
<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> |
| 300 |
<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> |
| 301 |
<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> |
| 302 |
<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> |
| 303 |
<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> |
| 304 |
<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> |
| 305 |
<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> |
| 306 |
<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> |
| 307 |
<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> |
| 308 |
<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> |
| 309 |
<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> |
| 310 |
<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> |
| 311 |
<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> |
| 312 |
<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> |
| 313 |
<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> |
| 314 |
<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> |
| 315 |
<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> |
| 316 |
<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> |
| 317 |
<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> |
| 318 |
<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> |
| 319 |
<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> |
| 320 |
<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> |
| 321 |
<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> |
| 322 |
<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> |
| 323 |
<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> |
| 324 |
<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> |
| 325 |
<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> |
| 326 |
<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> |
| 327 |
<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> |
| 328 |
<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> |
| 329 |
<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> |
| 330 |
<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> |
| 331 |
<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> |
| 332 |
<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> |
| 333 |
<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> |
| 334 |
<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> |
| 335 |
<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> |
| 336 |
<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> |
| 337 |
<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> |
| 338 |
<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> |
| 339 |
<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> |
| 340 |
</tbody> |
| 341 |
</table> |
| 342 |
|
| 343 |
<div class="pager"> |
| 344 |
<img src="../addons/pager/icons/first.png" class="first" alt="First" /> |
| 345 |
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" /> |
| 346 |
|
| 347 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 348 |
<img src="../addons/pager/icons/next.png" class="next" alt="Next" /> |
| 349 |
<img src="../addons/pager/icons/last.png" class="last" alt="Last" /> |
| 350 |
<select class="pagesize" title="Select page size"> |
| 351 |
<option value="10">10</option> |
| 352 |
<option value="20">20</option> |
| 353 |
<option value="30">30</option> |
| 354 |
<option value="all">All Rows</option> |
| 355 |
</select> |
| 356 |
<select class="gotoPage" title="Select page number"></select> |
| 357 |
</div> |
| 358 |
|
| 359 |
<h1>Javascript</h1> |
| 360 |
<div id="javascript"> |
| 361 |
<pre class="prettyprint lang-javascript"></pre> |
| 362 |
</div> |
| 363 |
|
| 364 |
<h1>CSS</h1> |
| 365 |
<div> |
| 366 |
<pre class="prettyprint lang-css">/* pager wrapper, div */ |
| 367 |
.tablesorter-pager { |
| 368 |
padding: 5px; |
| 369 |
} |
| 370 |
/* pager wrapper, in thead/tfoot */ |
| 371 |
td.tablesorter-pager { |
| 372 |
background-color: #e6eeee; |
| 373 |
margin: 0; /* needed for bootstrap .pager gets a 18px bottom margin */ |
| 374 |
} |
| 375 |
/* pager navigation arrows */ |
| 376 |
.tablesorter-pager img { |
| 377 |
vertical-align: middle; |
| 378 |
margin-right: 2px; |
| 379 |
cursor: pointer; |
| 380 |
} |
| 381 |
|
| 382 |
/* pager output text */ |
| 383 |
.tablesorter-pager .pagedisplay { |
| 384 |
padding: 0 5px 0 5px; |
| 385 |
width: 50px; |
| 386 |
text-align: center; |
| 387 |
} |
| 388 |
|
| 389 |
/* pager element reset (needed for bootstrap) */ |
| 390 |
.tablesorter-pager select { |
| 391 |
margin: 0; |
| 392 |
padding: 0; |
| 393 |
} |
| 394 |
|
| 395 |
/*** css used when "updateArrows" option is true ***/ |
| 396 |
/* the pager itself gets a disabled class when the number of rows is less than the size */ |
| 397 |
.tablesorter-pager.disabled { |
| 398 |
display: none; |
| 399 |
} |
| 400 |
/* hide or fade out pager arrows when the first or last row is visible */ |
| 401 |
.tablesorter-pager .disabled { |
| 402 |
/* visibility: hidden */ |
| 403 |
opacity: 0.5; |
| 404 |
filter: alpha(opacity=50); |
| 405 |
cursor: default; |
| 406 |
}</pre> |
| 407 |
</div> |
| 408 |
|
| 409 |
<h1>HTML</h1> |
| 410 |
<div id="html"> |
| 411 |
<pre class="prettyprint lang-html"><!-- jQuery --> |
| 412 |
<script src="js/jquery-latest.min.js"></script> |
| 413 |
|
| 414 |
<!-- Tablesorter: required --> |
| 415 |
<link href="css/theme.blue.css" rel="stylesheet"> |
| 416 |
<script src="js/jquery.tablesorter.js"></script> |
| 417 |
<script src="js/jquery.tablesorter.widgets.js"></script> |
| 418 |
|
| 419 |
<!-- Tablesorter: pager widget --> |
| 420 |
<link href="css/jquery.tablesorter.pager.css" rel="stylesheet"> |
| 421 |
<script src="js/widget-pager.js"></script> |
| 422 |
|
| 423 |
<table class="tablesorter"> |
| 424 |
<!-- view page source to see the entire table --> |
| 425 |
</table> |
| 426 |
|
| 427 |
<!-- pager --> |
| 428 |
<div id="pager" class="pager"> |
| 429 |
<form> |
| 430 |
<img src="first.png" class="first"/> |
| 431 |
<img src="prev.png" class="prev"/> |
| 432 |
<!-- the "pagedisplay" can be any element, including an input --> |
| 433 |
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} &ndash; {endRow} / {filteredRows} of {totalRows} total rows"></span> |
| 434 |
<img src="next.png" class="next"/> |
| 435 |
<img src="last.png" class="last"/> |
| 436 |
<select class="pagesize"> |
| 437 |
<option value="10">10</option> |
| 438 |
<option value="20">20</option> |
| 439 |
<option value="30">30</option> |
| 440 |
<option value="40">40</option> |
| 441 |
<option value="all">All Rows</option> |
| 442 |
</select> |
| 443 |
</form> |
| 444 |
</div></pre> |
| 445 |
|
| 446 |
</div> |
| 447 |
|
| 448 |
<a id="change-log"></a> |
| 449 |
<h1>Pager Change Log</h1> |
| 450 |
<ul> |
| 451 |
<li>Moved to <a href="https://github.com/Mottie/tablesorter/wiki/Changes">wiki pages</a>.</li> |
| 452 |
</ul> |
| 453 |
|
| 454 |
</div> |
| 455 |
|
| 456 |
</body> |
| 457 |
</html> |