| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - resetting the entire table sort</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-1.4.4.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 |
|
| 20 |
<script id="js">$(function() { |
| 21 |
// call the tablesorter plugin |
| 22 |
$("table").tablesorter({ |
| 23 |
theme : 'blue', |
| 24 |
sortList: [ [0,0],[1,0],[2,0] ], |
| 25 |
widgets: ['zebra'] |
| 26 |
}); |
| 27 |
|
| 28 |
$('button').click(function() { |
| 29 |
$('table').trigger('sortReset'); |
| 30 |
return false; |
| 31 |
}); |
| 32 |
|
| 33 |
});</script> |
| 34 |
</head> |
| 35 |
<body> |
| 36 |
<div id="banner"> |
| 37 |
<h1>table<em>sorter</em></h1> |
| 38 |
<h2>Resetting the entire table sort</h2> |
| 39 |
<h3>Flexible client-side table sorting</h3> |
| 40 |
<a href="index.html">Back to documentation</a> |
| 41 |
</div> |
| 42 |
<div id="main"> |
| 43 |
|
| 44 |
<p class="tip"> |
| 45 |
<em>NOTE!</em> |
| 46 |
</p> |
| 47 |
<ul> |
| 48 |
<li>Click on the reset button to reset the sort. The button can be used at any time.</li> |
| 49 |
<li>Reset the table by triggering a <code>sortReset</code> event on the table (see the javascript code below).</li> |
| 50 |
<li>This method was added in version 2.4.7.</li> |
| 51 |
</ul> |
| 52 |
|
| 53 |
<h1>Demo</h1> |
| 54 |
<button type="button">Reset</button> |
| 55 |
<div id="demo"><table class="tablesorter"> |
| 56 |
<thead> |
| 57 |
<tr> |
| 58 |
<th>Account #</th> |
| 59 |
<th>First Name</th> |
| 60 |
<th>Last Name</th> |
| 61 |
<th>Age</th> |
| 62 |
<th>Total</th> |
| 63 |
<th>Discount</th> |
| 64 |
<th>Diff</th> |
| 65 |
</tr> |
| 66 |
</thead> |
| 67 |
<tbody> |
| 68 |
<tr> |
| 69 |
<td>A43</td> |
| 70 |
<td>Peter</td> |
| 71 |
<td>Parker</td> |
| 72 |
<td>28</td> |
| 73 |
<td>9.99</td> |
| 74 |
<td>20.3%</td> |
| 75 |
<td>+3</td> |
| 76 |
</tr> |
| 77 |
<tr> |
| 78 |
<td>A255</td> |
| 79 |
<td>John</td> |
| 80 |
<td>Hood</td> |
| 81 |
<td>33</td> |
| 82 |
<td>19.99</td> |
| 83 |
<td>25.1%</td> |
| 84 |
<td>-7</td> |
| 85 |
</tr> |
| 86 |
<tr> |
| 87 |
<td>A33</td> |
| 88 |
<td>Clark</td> |
| 89 |
<td>Kent</td> |
| 90 |
<td>18</td> |
| 91 |
<td>2.89</td> |
| 92 |
<td>44.2%</td> |
| 93 |
<td>-15</td> |
| 94 |
</tr> |
| 95 |
<tr> |
| 96 |
<td>A1</td> |
| 97 |
<td>Bruce</td> |
| 98 |
<td>Almighty</td> |
| 99 |
<td>45</td> |
| 100 |
<td>153.19</td> |
| 101 |
<td>44%</td> |
| 102 |
<td>+19</td> |
| 103 |
</tr> |
| 104 |
<tr> |
| 105 |
<td>A102</td> |
| 106 |
<td>Bruce</td> |
| 107 |
<td>Evans</td> |
| 108 |
<td>56</td> |
| 109 |
<td>$153.19</td> |
| 110 |
<td>23%</td> |
| 111 |
<td>+9</td> |
| 112 |
</tr> |
| 113 |
<tr> |
| 114 |
<td>A256</td> |
| 115 |
<td>John</td> |
| 116 |
<td>Clark</td> |
| 117 |
<td>44</td> |
| 118 |
<td>($19.89)</td> |
| 119 |
<td>25.1%</td> |
| 120 |
<td>(5)</td> |
| 121 |
</tr> |
| 122 |
<tr> |
| 123 |
<td>A23</td> |
| 124 |
<td>Elvis</td> |
| 125 |
<td>Presley</td> |
| 126 |
<td>24</td> |
| 127 |
<td>($9.99)</td> |
| 128 |
<td>50%</td> |
| 129 |
<td>(22)</td> |
| 130 |
</tr> |
| 131 |
<tr> |
| 132 |
<td>A10</td> |
| 133 |
<td>Frank</td> |
| 134 |
<td>Carter</td> |
| 135 |
<td>40</td> |
| 136 |
<td>-12.99</td> |
| 137 |
<td>20%</td> |
| 138 |
<td>(6)</td> |
| 139 |
</tr> |
| 140 |
</tbody> |
| 141 |
</table></div> |
| 142 |
|
| 143 |
<h1>Javascript</h1> |
| 144 |
<div id="javascript"> |
| 145 |
<pre class="prettyprint lang-javascript"></pre> |
| 146 |
</div> |
| 147 |
|
| 148 |
<div class="next-up"> |
| 149 |
<hr /> |
| 150 |
Next up: <a href="example-option-selectorsort.html">Using selectorSort ››</a> |
| 151 |
</div> |
| 152 |
|
| 153 |
</div> |
| 154 |
|
| 155 |
</body> |
| 156 |
</html> |