mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-12-05 05:04:20 +00:00
458 lines
25 KiB
HTML
458 lines
25 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>jQuery tablesorter 2.0 - Pager Widget</title>
|
|
|
|
<!-- jQuery -->
|
|
<script src="js/jquery-latest.min.js"></script>
|
|
|
|
<!-- Demo stuff -->
|
|
<link href="css/jq.css" rel="stylesheet">
|
|
<link href="css/prettify.css" rel="stylesheet">
|
|
<script src="js/prettify.js"></script>
|
|
<script src="js/docs.js"></script>
|
|
|
|
<!-- Tablesorter: required -->
|
|
<link href="../css/theme.blue.css" rel="stylesheet">
|
|
<script src="../js/jquery.tablesorter.js"></script>
|
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
|
|
|
<!-- Tablesorter: optional -->
|
|
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
|
<script src="../js/widgets/widget-pager.js"></script>
|
|
|
|
<script id="js">$(function() {
|
|
|
|
var $table = $('table');
|
|
|
|
$table
|
|
|
|
// Initialize tablesorter
|
|
// ***********************
|
|
.tablesorter({
|
|
theme: 'blue',
|
|
widthFixed: true,
|
|
widgets: ['zebra', 'filter', 'pager'],
|
|
|
|
widgetOptions: {
|
|
|
|
// ** NOTE: All default ajax options have been removed from this demo,
|
|
// see the example-widget-pager-ajax demo for a full list of pager
|
|
// options
|
|
|
|
// css class names that are added
|
|
pager_css: {
|
|
container : 'tablesorter-pager', // class added to make included pager.css file work
|
|
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning); styled in theme file
|
|
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page)
|
|
},
|
|
|
|
// jQuery selectors
|
|
pager_selectors: {
|
|
container : '.pager', // target the pager markup (wrapper)
|
|
first : '.first', // go to first page arrow
|
|
prev : '.prev', // previous page arrow
|
|
next : '.next', // next page arrow
|
|
last : '.last', // go to last page arrow
|
|
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
|
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
|
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
|
},
|
|
|
|
// output default: '{page}/{totalPages}'
|
|
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
|
// also {page:input} & {startRow:input} will add a modifiable input in place of the value
|
|
pager_output: '{startRow:input} – {endRow} / {totalRows} rows', // '{page}/{totalPages}'
|
|
|
|
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
|
pager_updateArrows: true,
|
|
|
|
// starting page of the pager (zero based index)
|
|
pager_startPage: 0,
|
|
|
|
// Reset pager to this page after filtering; set to desired page number
|
|
// (zero-based index), or false to not change page at filter start
|
|
pager_pageReset: 0,
|
|
|
|
// Number of visible rows
|
|
pager_size: 10,
|
|
|
|
// f true, child rows will be counted towards the pager set size
|
|
pager_countChildRows: false,
|
|
|
|
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
|
pager_savePages: true,
|
|
|
|
// Saves tablesorter paging to custom key if defined. Key parameter name
|
|
// used by the $.tablesorter.storage function. Useful if you have
|
|
// multiple tables defined
|
|
pager_storageKey: "tablesorter-pager",
|
|
|
|
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
|
// table row set to a height to compensate; default is false
|
|
pager_fixedHeight: true,
|
|
|
|
// remove rows from the table to speed up the sort of large tables.
|
|
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
|
pager_removeRows: false // removing rows in larger tables speeds up the sort
|
|
|
|
}
|
|
|
|
})
|
|
|
|
// bind to pager events
|
|
// *********************
|
|
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) {
|
|
var p = c.pager, // NEW with the widget... it returns config, instead of config.pager
|
|
msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
|
|
' page <span class="typ">' + (p.page + 1) + '/' + p.totalPages + '</span>';
|
|
$('#display')
|
|
.append('<li><span class="str">"' + e.type + msg + '</li>')
|
|
.find('li:first').remove();
|
|
})
|
|
|
|
// Add two new rows using the "addRows" method
|
|
// the "update" method doesn't work here because not all rows are
|
|
// present in the table when the pager is applied ("removeRows" is false)
|
|
// ***********************************************************************
|
|
var r, $row, num = 50,
|
|
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>' +
|
|
'<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>';
|
|
$('button:contains(Add)').click(function() {
|
|
// add two rows of random data!
|
|
r = row.replace(/\{[gijmr]\}/g, function(m) {
|
|
return {
|
|
'{i}' : num + 1,
|
|
'{j}' : num + 2,
|
|
'{r}' : Math.round(Math.random() * 100),
|
|
'{g}' : Math.random() > 0.5 ? 'male' : 'female',
|
|
'{m}' : Math.random() > 0.5 ? 'Mathematics' : 'Languages'
|
|
}[m];
|
|
});
|
|
num = num + 2;
|
|
$row = $(r);
|
|
$table
|
|
.find('tbody').append($row)
|
|
.trigger('addRows', [$row]);
|
|
return false;
|
|
});
|
|
|
|
// Delete a row
|
|
// *************
|
|
$table.delegate('button.remove', 'click' ,function() {
|
|
// disabling the pager will restore all table rows
|
|
// $table.trigger('disablePager');
|
|
// remove chosen row
|
|
$(this).closest('tr').remove();
|
|
// restore pager
|
|
// $table.trigger('enablePager');
|
|
$table.trigger('update');
|
|
return false;
|
|
});
|
|
|
|
// Destroy pager / Restore pager
|
|
// **************
|
|
$('button:contains(Destroy)').click(function() {
|
|
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
|
var $t = $(this);
|
|
if (/Destroy/.test( $t.text() )) {
|
|
$table.trigger('destroyPager');
|
|
$t.text('Restore Pager');
|
|
} else {
|
|
$('table').trigger('applyWidgetId', 'pager');
|
|
$t.text('Destroy Pager');
|
|
}
|
|
return false;
|
|
});
|
|
|
|
// Disable / Enable
|
|
// **************
|
|
$('.toggle').click(function() {
|
|
var mode = /Disable/.test( $(this).text() );
|
|
// using disablePager or enablePager
|
|
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
|
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
|
|
return false;
|
|
});
|
|
$table.bind('pagerChange', function() {
|
|
// pager automatically enables when table is sorted.
|
|
$('.toggle').text('Disable Pager');
|
|
});
|
|
|
|
// clear storage (page & size)
|
|
$('.clear-pager-data').click(function() {
|
|
// clears user set page & size from local storage, so on page
|
|
// reload the page & size resets to the original settings
|
|
$.tablesorter.storage( $table, 'tablesorter-pager', '' );
|
|
});
|
|
|
|
// go to page 1 showing 10 rows
|
|
$('.goto').click(function() {
|
|
// triggering "pageAndSize" without parameters will reset the
|
|
// pager to page 1 and the original set size (10 by default)
|
|
// $('table').trigger('pageAndSize')
|
|
$table.trigger('pageAndSize', [1, 10]);
|
|
});
|
|
|
|
});</script>
|
|
</head>
|
|
<body id="pager-demo">
|
|
<div id="banner">
|
|
<h1>table<em>sorter</em></h1>
|
|
<h2>Pager Widget</h2>
|
|
<h3>Flexible client-side table sorting</h3>
|
|
<a href="index.html">Back to documentation</a>
|
|
</div>
|
|
|
|
<div id="main">
|
|
|
|
<p class="tip">
|
|
<em>NOTE!</em>
|
|
</p>
|
|
<ul>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<li>In <span class="version">v2.19.0</span>, added <code>pageAndSize</code> method which allows setting both the pager page & size.</li>
|
|
<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>
|
|
|
|
<li>This pager WIDGET <em>can not</em> be applied to the original tablesorter.</li>
|
|
<li>Do not use this widget along with the pager plugin.</li>
|
|
<li>The pager.css file also works with this pager widget.</li>
|
|
<li>This widget is still in <span class="beta">development</span> as it has not been throughly tested.</li>
|
|
<li>Extensive documentation has not been included, as all functioning is essentially identical to the pager addon, but here are some important differences:
|
|
<ul>
|
|
<li>All of the options are now set within the <code>widgetOptions</code>.</li>
|
|
<li>Pager events (pagerChange pagerComplete pagerInitialized pageMoved) now return <code>table.config</code> instead of <code>table.config.pager</code>.</li>
|
|
<li>Most option names have only been modified by adding <code>pager_</code> as a prefix.</li>
|
|
<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>
|
|
<li>Because I stopped trying so hard to make widgets compatible with jQuery v1.2.6, this widget requires at least v1.3+.</li>
|
|
<li>See the Javascript code below for a full example.</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h1>Triggered Events</h1>
|
|
<ul id="display">
|
|
<li>Pager events will appear here.</li>
|
|
<li> </li>
|
|
<li> </li>
|
|
</ul>
|
|
|
|
<h1>Demo</h1>
|
|
<br>
|
|
<button type="button">Add Rows</button> <button type="button" class="toggle">Disable Pager</button> <button type="button">Destroy Pager</button>
|
|
<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>
|
|
<div class="pager">
|
|
<img src="../addons/pager/icons/first.png" class="first" alt="First" />
|
|
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" />
|
|
<!-- the "pagedisplay" can be any element, including an input -->
|
|
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span>
|
|
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
|
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
|
<select class="pagesize" title="Select page size">
|
|
<option value="10">10</option>
|
|
<option value="20">20</option>
|
|
<option value="30">30</option>
|
|
<option value="all">All Rows</option>
|
|
</select>
|
|
<select class="gotoPage" title="Select page number"></select>
|
|
</div>
|
|
|
|
<table class="tablesorter">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Major</th>
|
|
<th>Sex</th>
|
|
<th>English</th>
|
|
<th>Japanese</th>
|
|
<th>Calculus</th>
|
|
<th>Geometry</th>
|
|
<th class="remove sorter-false"></th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Major</th>
|
|
<th>Sex</th>
|
|
<th>English</th>
|
|
<th>Japanese</th>
|
|
<th>Calculus</th>
|
|
<th>Geometry</th>
|
|
<th></th>
|
|
</tr>
|
|
</tfoot>
|
|
<tbody>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="pager">
|
|
<img src="../addons/pager/icons/first.png" class="first" alt="First" />
|
|
<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" />
|
|
<!-- the "pagedisplay" can be any element, including an input -->
|
|
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span>
|
|
<img src="../addons/pager/icons/next.png" class="next" alt="Next" />
|
|
<img src="../addons/pager/icons/last.png" class="last" alt="Last" />
|
|
<select class="pagesize" title="Select page size">
|
|
<option value="10">10</option>
|
|
<option value="20">20</option>
|
|
<option value="30">30</option>
|
|
<option value="all">All Rows</option>
|
|
</select>
|
|
<select class="gotoPage" title="Select page number"></select>
|
|
</div>
|
|
|
|
<h1>Javascript</h1>
|
|
<div id="javascript">
|
|
<pre class="prettyprint lang-javascript"></pre>
|
|
</div>
|
|
|
|
<h1>CSS</h1>
|
|
<div>
|
|
<pre class="prettyprint lang-css">/* pager wrapper, div */
|
|
.tablesorter-pager {
|
|
padding: 5px;
|
|
}
|
|
/* pager wrapper, in thead/tfoot */
|
|
td.tablesorter-pager {
|
|
background-color: #e6eeee;
|
|
margin: 0; /* needed for bootstrap .pager gets a 18px bottom margin */
|
|
}
|
|
/* pager navigation arrows */
|
|
.tablesorter-pager img {
|
|
vertical-align: middle;
|
|
margin-right: 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* pager output text */
|
|
.tablesorter-pager .pagedisplay {
|
|
padding: 0 5px 0 5px;
|
|
width: 50px;
|
|
text-align: center;
|
|
}
|
|
|
|
/* pager element reset (needed for bootstrap) */
|
|
.tablesorter-pager select {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
/*** css used when "updateArrows" option is true ***/
|
|
/* the pager itself gets a disabled class when the number of rows is less than the size */
|
|
.tablesorter-pager.disabled {
|
|
display: none;
|
|
}
|
|
/* hide or fade out pager arrows when the first or last row is visible */
|
|
.tablesorter-pager .disabled {
|
|
/* visibility: hidden */
|
|
opacity: 0.5;
|
|
filter: alpha(opacity=50);
|
|
cursor: default;
|
|
}</pre>
|
|
</div>
|
|
|
|
<h1>HTML</h1>
|
|
<div id="html">
|
|
<pre class="prettyprint lang-html"><!-- jQuery -->
|
|
<script src="js/jquery-latest.min.js"></script>
|
|
|
|
<!-- Tablesorter: required -->
|
|
<link href="css/theme.blue.css" rel="stylesheet">
|
|
<script src="js/jquery.tablesorter.js"></script>
|
|
<script src="js/jquery.tablesorter.widgets.js"></script>
|
|
|
|
<!-- Tablesorter: pager widget -->
|
|
<link href="css/jquery.tablesorter.pager.css" rel="stylesheet">
|
|
<script src="js/widget-pager.js"></script>
|
|
|
|
<table class="tablesorter">
|
|
<!-- view page source to see the entire table -->
|
|
</table>
|
|
|
|
<!-- pager -->
|
|
<div id="pager" class="pager">
|
|
<form>
|
|
<img src="first.png" class="first"/>
|
|
<img src="prev.png" class="prev"/>
|
|
<!-- the "pagedisplay" can be any element, including an input -->
|
|
<span class="pagedisplay" data-pager-output-filtered="{startRow:input} &ndash; {endRow} / {filteredRows} of {totalRows} total rows"></span>
|
|
<img src="next.png" class="next"/>
|
|
<img src="last.png" class="last"/>
|
|
<select class="pagesize">
|
|
<option value="10">10</option>
|
|
<option value="20">20</option>
|
|
<option value="30">30</option>
|
|
<option value="40">40</option>
|
|
<option value="all">All Rows</option>
|
|
</select>
|
|
</form>
|
|
</div></pre>
|
|
|
|
</div>
|
|
|
|
<a id="change-log"></a>
|
|
<h1>Pager Change Log</h1>
|
|
<ul>
|
|
<li>Moved to <a href="https://github.com/Mottie/tablesorter/wiki/Changes">wiki pages</a>.</li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|