Debian Codegraph @

docs/example-option-sortreset-sortrestart.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Reset/Restart the sort</title>
6
7 <!-- jQuery -->
8 <script src="js/jquery-latest.min.js"></script>
9
10 <!-- Demo stuff -->
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 <!-- Tablesorter: required -->
17 <link rel="stylesheet" href="../css/theme.blue.css">
18 <script src="../js/jquery.tablesorter.js"></script>
19
20 <script id="js">$(function() {
21
22 // call the tablesorter plugin
23 $("table").tablesorter({
24 theme : 'blue',
25
26 // third click on the header will reset column to default - unsorted
27 sortReset : true,
28 // Resets the sort direction so that clicking on an unsorted column will sort in the sortInitialOrder direction.
29 sortRestart : true,
30
31 sortInitialOrder: 'desc',
32
33 headers : {
34 // 0 : { lockedOrder: 'asc' }, only allow sorting in one direction
35 3 : { sortInitialOrder: 'asc' },
36 4 : { sortInitialOrder: 'asc' },
37 5 : { sortInitialOrder: 'asc' }
38 }
39
40 });
41
42 });</script>
43 </head>
44 <body>
45 <div id="banner">
46 <h1>table<em>sorter</em></h1>
47 <h2>Reset/Restart the sort</h2>
48 <h3>Flexible client-side table sorting</h3>
49 <a href="index.html">Back to documentation</a>
50 </div>
51 <div id="main">
52
53 <p class="tip">
54 <em>NOTE!</em>
55 </p>
56 <ul>
57 <li>The default <code>sortInitialOrder</code> for the entire table is set to <code>desc</code> (descending sort).</li>
58 <li>The last three columns have the initial sort order set in the ascending direction, using the headers option.</li>
59 <li>Test the <code>sortReset</code> option by clicking on any column at least three times. It should sort in the <code>sortInitialOrder</code> direction on the first click, the opposite direction on the second click, then reset to the original sort order on the third click. This cycle repeats on subsequent sorts.</li>
60 <li>Test the <code>sortRestart</code> option by clicking on any unsorted column to see that it will always restart from the <code>sortInitialOrder</code>.</li>
61 </ul>
62
63 <h1>Demo</h1>
64 <div id="demo"><table class="tablesorter">
65 <thead>
66 <tr>
67 <th>First Name (desc)</th>
68 <th>Last Name (desc)</th>
69 <th>Age (desc)</th>
70 <th>Total (asc)</th>
71 <th>Discount (asc)</th>
72 <th>Date (asc)</th>
73 </tr>
74 </thead>
75 <tbody>
76 <tr>
77 <td>Peter</td>
78 <td>Parker</td>
79 <td>28</td>
80 <td>$9.99</td>
81 <td>20%</td>
82 <td>Jul 6, 2006 8:14 AM</td>
83 </tr>
84 <tr>
85 <td>Robin</td>
86 <td>Hood</td>
87 <td>33</td>
88 <td>$19.99</td>
89 <td>25%</td>
90 <td>Dec 10, 2002 5:14 AM</td>
91 </tr>
92 <tr>
93 <td>Clark</td>
94 <td>Kent</td>
95 <td>18</td>
96 <td>$15.89</td>
97 <td>44%</td>
98 <td>Jan 12, 2003 11:14 AM</td>
99 </tr>
100 <tr>
101 <td>Bruce</td>
102 <td>Almighty</td>
103 <td>45</td>
104 <td>$153.19</td>
105 <td>44%</td>
106 <td>Jan 18, 2001 9:12 AM</td>
107 </tr>
108 <tr>
109 <td>Bruce</td>
110 <td>Evans</td>
111 <td>22</td>
112 <td>$13.19</td>
113 <td>11%</td>
114 <td>Jan 18, 2007 9:12 AM</td>
115 </tr>
116 </tbody>
117 </table></div>
118 <h1>Javascript</h1>
119 <div id="javascript">
120 <pre class="prettyprint lang-javascript"></pre>
121 </div>
122 <h1>HTML</h1>
123 <div id="html">
124 <pre class="prettyprint lang-html"></pre>
125 </div>
126
127 <div class="next-up">
128 <hr />
129 Next up: <a href="example-method-sortreset.html">Resetting the entire table sort &rsaquo;&rsaquo;</a>
130 </div>
131
132 </div>
133
134
135 </body>
136 </html>