Debian Codegraph @

docs/example-widget-sticky-header.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery tablesorter 2.0 - Sticky Header Widget</title>
6
7 <!-- jQuery -->
8 <script src="js/jquery-latest.min.js"></script>
9 <script src="js/jquery-ui.min.js"></script>
10
11 <!-- Demo stuff -->
12 <link rel="stylesheet" href="css/jq.css">
13 <link href="css/prettify.css" rel="stylesheet">
14 <link rel="stylesheet" href="css/magnific-popup.css">
15 <link rel="stylesheet" href="css/jquery-ui.min.css">
16 <script src="js/prettify.js"></script>
17 <script src="js/docs.js"></script>
18 <script src="js/jquery.magnific-popup.min.js"></script>
19
20 <!-- Tablesorter: theme -->
21 <link class="theme default" rel="stylesheet" href="../css/theme.default.css">
22 <link class="theme blue" rel="stylesheet" href="../css/theme.blue.css">
23 <link class="theme green" rel="stylesheet" href="../css/theme.green.css">
24 <link class="theme grey" rel="stylesheet" href="../css/theme.grey.css">
25 <link class="theme ice" rel="stylesheet" href="../css/theme.ice.css">
26 <link class="theme black-ice" rel="stylesheet" href="../css/theme.black-ice.css">
27 <link class="theme dark" rel="stylesheet" href="../css/theme.dark.css">
28 <link class="theme dropbox" rel="stylesheet" href="../css/theme.dropbox.css">
29 <link class="theme metro-dark" rel="stylesheet" href="../css/theme.metro-dark.css">
30
31 <style id="css">/* wrapper of table 2 */
32 .wrapper {
33 position: relative;
34 padding: 0 5px;
35 height: 250px;
36 overflow-y: auto;
37 }
38
39 /* Magnific popup */
40 #popup {
41 position: relative;
42 background: #FFF;
43 padding: 20px;
44 width: auto;
45 max-width: 500px;
46 margin: 20px auto;
47 }
48 /* Since the popup has a 20px margin, we need to adjust the wrapper position
49 Note:
50 this is only required because we aren't actually attaching the sticky header
51 to the #popup, instead we're attaching it to the .mfp-wrap because that
52 element scrolls instead of the window
53 */
54 #popup .tablesorter-sticky-wrapper {
55 margin-left: 20px;
56 margin-top: -20px;
57 }</style>
58
59 <!-- Tablesorter script: required -->
60 <script src="../js/jquery.tablesorter.js"></script>
61 <script src="../js/widgets/widget-filter.js"></script>
62 <script src="../js/widgets/widget-stickyHeaders.js"></script>
63
64 <script id="js">$(function() {
65
66 $('.open-popup-link').magnificPopup({
67 type: 'inline',
68 midClick: true,
69 callbacks: {
70 open: function () {
71 // Will fire when this exact popup is opened
72 // this - is Magnific Popup object
73 $('#table0').tablesorter({
74 theme: 'blue',
75 headerTemplate : '{content} {icon}', // Add icon for various themes
76 widgets: ['zebra', 'filter', 'stickyHeaders'],
77 widgetOptions: {
78 // jQuery selector or object to attach sticky header to
79 stickyHeaders_attachTo: '.mfp-wrap',
80 stickyHeaders_offset: 0,
81 // caption set by demo button value
82 stickyHeaders_includeCaption: includeCaption
83 }
84 });
85 }
86 }
87 });
88
89 $('#table1, .nested, #table3').tablesorter({
90 widthFixed : true,
91 showProcessing: true,
92 headerTemplate : '{content} {icon}', // Add icon for various themes
93
94 widgets: [ 'zebra', 'stickyHeaders', 'filter' ],
95
96 widgetOptions: {
97
98 // extra class name added to the sticky header row
99 stickyHeaders : '',
100 // number or jquery selector targeting the position:fixed element
101 stickyHeaders_offset : 0,
102 // added to table ID, if it exists
103 stickyHeaders_cloneId : '-sticky',
104 // trigger "resize" event on headers
105 stickyHeaders_addResizeEvent : true,
106 // if false and a caption exist, it won't be included in the sticky header
107 stickyHeaders_includeCaption : true,
108 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
109 stickyHeaders_zIndex : 2,
110 // jQuery selector or object to attach sticky header to
111 stickyHeaders_attachTo : null,
112 // jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window)
113 stickyHeaders_xScroll : null,
114 // jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window)
115 stickyHeaders_yScroll : null,
116
117 // scroll table top into view after filtering
118 stickyHeaders_filteredToTop: true
119
120 // *** REMOVED jQuery UI theme due to adding an accordion on this demo page ***
121 // adding zebra striping, using content and default styles - the ui css removes the background from default
122 // even and odd class names included for this demo to allow switching themes
123 // , zebra : ["ui-widget-content even", "ui-state-default odd"]
124 // use uitheme widget to apply defauly jquery ui (jui) class names
125 // see the uitheme demo for more details on how to change the class names
126 // , uitheme : 'jui'
127 }
128 });
129
130 /* make second table scroll within its wrapper */
131 $('#table2').tablesorter({
132 widthFixed : true,
133 headerTemplate : '{content} {icon}', // Add icon for various themes
134
135 widgets: [ 'zebra', 'stickyHeaders', 'filter' ],
136
137 widgetOptions: {
138 // jQuery selector or object to attach sticky header to
139 stickyHeaders_attachTo : '.wrapper' // or $('.wrapper')
140 }
141 });
142
143 });</script>
144 <script>
145 $(function() {
146
147 window.includeCaption = true;
148 $('.caption').on('click', function() {
149 includeCaption = !includeCaption;
150 $(this).html( '' + includeCaption );
151 $('#table0, #table1, #table2, #table3, .nested').each(function() {
152 if (this.config) {
153 this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
154 this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
155 }
156 });
157 });
158
159 // removed jQuery UI theme because of the accordion!
160 $('link.theme').each(function() { this.disabled = true; });
161
162 var themes = 'blue default green grey ice black-ice dark dropbox metro-dark',
163 i, o = '', t = themes.split(' ');
164 for (i = 0; i < t.length; i++) {
165 o += '<option value="' + t[i] + '">' + t[i] + '</option>';
166 }
167
168 $('select:first')
169 .append(o)
170 .change(function() {
171 var theme = $(this).val().toLowerCase(),
172 // ui-theme is added by the themeswitcher
173 files = $('link.theme').each(function() {
174 this.disabled = true;
175 })
176 files.filter('.' + theme).each(function() {
177 this.disabled = false;
178 });
179 $('table')
180 .removeClass('tablesorter-' + t.join(' tablesorter-'))
181 .addClass('tablesorter-' + (theme === 'black-ice' ? 'blackice' : theme) );
182 }).change();
183 });
184 </script>
185 </head>
186 <body>
187
188 <div id="banner">
189 <h1>table<em>sorter</em></h1>
190 <h2>Sticky Header Widget</h2>
191 <h3>Flexible client-side table sorting</h3>
192 <a href="index.html">Back to documentation</a>
193 </div>
194
195 <div id="main">
196
197 <p></p>
198 <br>
199
200 <div id="root" class="accordion">
201
202 <h3><a href="#">Notes</a></h3>
203 <div>
204 <ul>
205 <li>In <span class="version">v2.18.4</span>, added a <a href="http://dimsemenov.com/plugins/magnific-popup/">Magnific popup</a> example to this page. <span class="label label-info">Note</span> Please take note of the extra css needed to keep the sticky header aligned.</li>
206 <li>In <span class="version">v2.18.0</span>,
207 <ul>
208 <li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li>
209 <li>Added <code>stickyHeaders_xScroll</code> and <code>stickyHeaders_yScroll</code> widget options.</li>
210 <li>Any defined <a href="index.html#onrenderheader"><code>onRenderHeader</code></a> function is now executed on the cloned sticky header table cells; the <a href="index.html#onrendertemplate"><code>onRenderTemplate</code></a> function is <em>not</em>! See the change log section for more details.</li>
211 </ul>
212 <br>
213 </li>
214
215 <li><span class="label label-info">Note</span> To access the added sticky table content from your code without worrying about using the ID, you can use <code>table.config.widgetOptions.$sticky</code>.</li>
216 <li><span class="label label-info">Note</span> Add the class name <code>sticky-false</code> to any header rows you don't want to become sticky (v2.1.18).<p></p></li>
217
218 <li>You will need to modify the <code>headerTemplate</code> option to include the jQuery UI icon! See the example in the code (v2.7).</li>
219 <li>Scroll down the page to see the headers stick. Then sort the columns using the sticky headers!</li>
220 <li>Multiple rows in the header, including the filter row, will become sticky.</li>
221
222 <li><strong>As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8</strong>.</li>
223 <li><strong>Because of the limitations of Internet Explorer version 7 and older, this widget will not work</strong>.</li>
224
225 </ul>
226 </div>
227
228 <h3><a href="#">Options</a></h3>
229 <div>
230 <h4>stickyHeaders widget defaults (added inside of tablesorter <code>widgetOptions</code>)</h4>
231 <div>
232 <span class="label label-info">TIP!</span> Click on the link in the function column to reveal full details (or <a href="#" class="toggleAll">toggle</a>|<a href="#" class="showAll">show</a>|<a href="#" class="hideAll">hide</a> all) or double click to update the browser location.
233 </div>
234 <table class="options tablesorter-blue" data-sortlist="[[0,0]]">
235 <thead>
236 <tr><th>Option</th><th>Default</th><th class="sorter-false">Description</th></tr>
237 </thead>
238 <tbody>
239
240 <tr id="stickyheaders">
241 <td><a href="#" class="permalink">stickyHeaders</a></td>
242 <td>''</td>
243 <td>Include any extra class name to be added to the sticky header table (v2.1; <span class="version updated">v2.18.0</span>)
244 <div class="collapsible">
245 <br>
246 <span class="label warning">Note</span> prior to v2.18.0, this class was applied to the sticky table <code>thead</code>; after v2.18.0, the <code>thead</code> and <code>caption</code> are wrapped in a div that is made sticky, with this class name.<br>
247 <br>
248 Modified in <span class="version">v2.11</span> so that "tablesorter-stickyHeader" class is always added and this option only adds additional classes.
249 </div>
250 </td>
251 </tr>
252
253 <tr id="stickyheaders-offset">
254 <td><span class="permalink">stickyHeaders_offset</span></td>
255 <td>0</td>
256 <td>Set this to a number (in pixels) or jquery selector targeting the <code>position:fixed</code> element in which to place the sticky header below while scrolling.</td>
257 </tr>
258
259 <tr id="stickyheaders-cloneid">
260 <td><a href="#" class="permalink">stickyHeaders_cloneId</a></td>
261 <td>'-sticky'</td>
262 <td>If the original table has an ID, then the value from this option is added to the end of the cloned table to maintain a unique ID (<span class="version">v2.9</span>).
263 <div class="collapsible">
264 <ul>
265 <li>It contains a suffix to add to any table id.</li>
266 <li>Its default value is <code>-sticky</code> </li>
267 </ul>
268 </div>
269 </td>
270 </tr>
271
272 <tr id="stickyheaders-addresizeevent">
273 <td><span class="permalink">stickyHeaders_addResizeEvent</span></td>
274 <td>true</td>
275 <td>When <code>true</code>, the <a href="index.html#function-resizeevent"><code>$.tablesorter.addHeaderResizeEvent</code></a> function is applied to the table header cells so a "resize" event is triggered and the sticky headers widget can then properly resize the cloned table header cells to match the originals.</td>
276 </tr>
277
278 <tr id="stickyheaders-includecaption">
279 <td><span class="permalink">stickyHeaders_includeCaption</span></td>
280 <td>true</td>
281 <td>If <code>false</code> and a table caption exist, it won't be included in the sticky header.</td>
282 </tr>
283
284 <tr id="stickyheaders-zindex">
285 <td><span class="permalink">stickyHeaders_zIndex</span></td>
286 <td>2</td>
287 <td>Adjust the zIndex of the stickyHeaders element as desired.</td>
288 </tr>
289
290 <tr id="stickyheaders-attachto">
291 <td><a href="#" class="permalink">stickyHeaders_attachTo</a></td>
292 <td>null</td>
293 <td>Set this option as a jQuery selector or object where the sticky header will be attached (<span class="version">v2.14.4</span>).
294 <div class="collapsible">
295 <ul>
296 <li>Setting this option with either a jQuery selector string (<code>&quot;.wrapper&quot;</code>) or jQuery object (<code>$(&quot;.wrapper&quot;)</code>).</li>
297 <li>This option contains the target to which the sticky header will attach - see the <a href="#table2">second example</a> below.</li>
298 </ul>
299 </div>
300 </td>
301 </tr>
302
303 <tr id="stickyheaders-filteredtotop">
304 <td><a href="#" class="permalink">stickyHeaders_filteredToTop</a></td>
305 <td>true</td>
306 <td>Scroll table top into view after filtering (<span class="version updated">v2.16.2</span>)
307 <div class="collapsible">
308 <br>
309 This is needed when the user choses to filter the table which results in fewer rows than are currently visible in the browser viewport. So, the sticky header may still exist, but the table body may not be seen. Setting this option to <code>true</code> forces the original table header to scroll back into view.
310 </div>
311 </td>
312 </tr>
313
314 <tr id="stickyheaders-xscroll">
315 <td><a href="#" class="permalink">stickyHeaders_xScroll</a></td>
316 <td>null</td>
317 <td>jQuery selector or object that will be used to monitor horizontal scroll position(<span class="version">v2.18.0</span>)
318 <div class="collapsible">
319 <br>
320 Defaults: xScroll > attachTo > window<br>
321 <br>
322 Indicate the element (jQuery selector or obect) in which to monitor for changes in scroll position; If undefined (<code>null</code> by default), the window is monitored.
323 </div>
324 </td>
325 </tr>
326
327 <tr id="stickyheaders-yscroll">
328 <td><a href="#" class="permalink">stickyHeaders_yScroll</a></td>
329 <td>null</td>
330 <td>jQuery selector or object that will be used to monitor vertical scroll position (<span class="version">v2.18.0</span>)
331 <div class="collapsible">
332 <br>
333 Defaults: yScroll > attachTo > window<br>
334 <br>
335 Indicate the element (jQuery selector or obect) in which to monitor for changes in scroll position; If undefined (<code>null</code> by default), the window is monitored.
336 </div>
337 </td>
338 </tr>
339
340 </tbody>
341 </table>
342 </div>
343
344 <h3><a href="#">Change log</a></h3>
345 <div>
346 <ul>
347 <li><span class="version">v2.18.0</span>:
348 <ul>
349 <li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li>
350 <li>Added <code>stickyHeaders_xScroll</code> and <code>stickyHeaders_yScroll</code> options to indicate the element (jQuery selector or obect) in which to monitor for changes in scroll position; If undefined (<code>null</code> by default), the window is monitored.</li>
351 <li>Any defined <a href="index.html#onrenderheader"><code>onRenderHeader</code></a> function is now executed on the cloned sticky header table cells. There are now 3 parameters available to this function:
352 <ul>
353 <li><code>index</code> - header cell index; this is <em>not</em> the column index!</li>
354 <li><code>config</code> - the <code>table.config</code> settings for the table.</li>
355 <li><code>$table</code> - the target of this parameter changes:
356 <ul>
357 <li>For the original table header cells, this parameter is a jQuery object pointing to the original table; this table has the class name <code>hasStickyHeaders</code>.</li>
358 <li>When the sticky table header cells are processed, this parameter is a jQuery object pointing to a copy of the table that is used as a sticky header; this table has the class name <code>containsStickyHeaders</code>.</li>
359 </ul>
360 </li>
361 </ul>
362 <span class="label label-info">Note</span> Any defined <a href="index.html#onrendertemplate"><code>onRenderTemplate</code></a> function is <em>not</em> called on the sticky header because it is a clone of the already rendered header cell; instead use <code>onRenderHeader</code> to attach event listeners, etc.
363 </li>
364 <li>Removed jQuery UI theme from the theme selector in this demo to accomodate adding the accordion. With the current setup, changing the table theme would continue to show the jQuery UI class names on the table (uitheme is not removed when switching themes), so the tables became a chimera of jQuery UI and the selected theme, and the accordion would become un-styled; it was a real mess.<br>
365 <br>
366 </li>
367 </ul>
368 </li>
369 <li><span class="version">v2.14.4</span>: Added <code>cssStickyHeaders_attachTo</code> option (default set to <code>null</code>).
370 <ul>
371 <li>Setting this option with either a jQuery selector string (<code>&quot;.wrapper&quot;</code>) or jQuery object (<code>$(&quot;.wrapper&quot;)</code>).</li>
372 <li>This option contains the target to which the sticky header will attach - see the <a href="#table2">second example</a> below.</li>
373 </ul>
374 </li>
375 <li>v2.9:
376 <ul>
377 <li><strong>As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8</strong>.</li>
378 <li>Added a widget option named <code>stickyHeaders_cloneId</code>
379 <ul>
380 <li>It contains a suffix to add to any table id.</li>
381 <li>Its default value is <code>-sticky</code> </li>
382 </ul>
383 </li>
384 <li>Table captions and any additional rows (filter widget row) will also be included in the sticky header.</li>
385 </ul>
386 </li>
387 <li>v2.7: You will need to modify the <code>headerTemplate</code> option to include the jQuery UI icon! See the example in the code.</li>
388 <li>v2.1.18: Add the class name <code>sticky-false</code> to any header rows you don't want to become sticky.</li>
389 <li>v2.1.17: Multiple rows in the header will become sticky.</li>
390 <li>v2.1 (updated v2.11): Added a widget option named <code>stickyHeaders</code> option which contains the css class name applied to the actual sticky header. Modified in <span class="version">v2.11</span> so that "tablesorter-stickyHeader" class is always added and this option only adds additional classes.</li>
391 </ul>
392 </div>
393
394 </div>
395
396 <h1>CSS</h1>
397 <div id="css">
398 <pre class="prettyprint lang-css"></pre>
399 </div>
400
401 <h1>Javascript</h1>
402 <div id="javascript">
403 <pre class="prettyprint lang-javascript"></pre>
404 </div>
405
406 <h1>Demo</h1>
407 Choose Theme:
408 <select></select>
409 <p></p>
410 Include Caption: <button type="button" class="caption">true</button>
411 <p></p>
412
413 <h3>Sticky headers in a popup window</h3>
414 <ul>
415 <li><a href="#popup" class="open-popup-link">Show table in Magnific popup window</a></li>
416 <li><a class="external" href="http://jsfiddle.net/Mottie/8j08gbzb/">Show table in jQuery UI Dialog</a></li>
417 <li><a class="external" href="http://jsfiddle.net/Mottie/Leyaxm70/">Show table in Bootstrap Modal</a></li>
418 </ul>
419
420 <div id="popup" class="white-popup mfp-hide">
421 <table id="table0" class="tablesorter">
422 <caption>Student Grades</caption>
423 <thead>
424 <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th class="filter-false sorter-false">Geometry</th></tr>
425 </thead>
426 <tfoot>
427 <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
428 </tfoot>
429 <tbody>
430 <tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
431 <tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
432 <tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
433 <tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
434 <tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
435 <tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
436 <tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
437 <tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
438 <tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
439 <tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
440 <tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
441 <tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
442 <tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
443 <tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
444 <tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
445 <tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
446 <tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
447 <tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
448 <tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
449 <tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
450 <tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
451 <tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
452 <tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
453 <tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
454 <tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
455 <tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
456 <tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
457 <tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
458 <tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
459 <tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
460 <tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
461 <tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
462 <tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
463 <tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
464 <tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
465 <tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
466 <tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
467 <tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
468 <tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
469 <tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
470 <tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
471 <tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
472 <tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
473 <tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
474 <tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
475 <tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
476 <tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
477 <tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
478 <tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
479 <tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
480 <tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
481 </tbody>
482 </table>
483 </div>
484
485 <h3>Attach sticky header to browser window</h3>
486 <table id="table1" class="tablesorter">
487 <caption class="dark-row">Student Grades</caption> <!-- dark-row used by metro-dark theme to make the header row darker -->
488 <thead>
489 <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th class="filter-false sorter-false">Geometry</th></tr>
490 </thead>
491 <tfoot>
492 <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
493 </tfoot>
494 <tbody>
495 <tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
496 <tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
497 <tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
498 <tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
499 <tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
500 <tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
501 <tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
502 <tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
503 <tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
504 <tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
505 <tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
506 <tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
507 <tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
508 <tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
509 <tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
510 <tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
511 <tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
512 <tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
513 <tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
514 <tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
515 <tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
516 <tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
517 <tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
518 <tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
519 <tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
520 <tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
521 <tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
522 <tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
523 <tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
524 <tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
525 <tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
526 <tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
527 <tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
528 <tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
529 <tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
530 <tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
531 <tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
532 <tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
533 <tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
534 <tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
535 <tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
536 <tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
537 <tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
538 <tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
539 <tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
540 <tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
541 <tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
542 <tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
543 <tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
544 <tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
545 <tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
546 </tbody>
547 </table>
548
549 <br>
550
551 <h3>Attach sticky header to its parent</h3>
552 <div class="narrow-block wrapper">
553 <table id="table2" class="tablesorter">
554 <caption class="dark-row">Student Grades</caption>
555 <thead>
556 <tr><th>Account #</th><th>First Name</th><th>Last Name</th><th>Age</th><th>Total</th><th>Discount</th><th>Diff</th></tr>
557 </thead>
558 <tbody>
559 <tr><td>A43</td><td>Peter</td><td>Parker</td><td>28</td><td>9.99</td><td>20.3%</td><td>+3</td></tr>
560 <tr><td>A255</td><td>John</td><td>Hood</td><td>33</td><td>19.99</td><td>25.1%</td><td>-7</td></tr>
561 <tr><td>A33</td><td>Clark</td><td>Kent</td><td>18</td><td>15.49</td><td>44.2%</td><td>-13</td></tr>
562 <tr><td>A11</td><td>Bruce</td><td>Almighty</td><td>45</td><td>153.19</td><td>44%</td><td>+19</td></tr>
563 <tr><td>A102</td><td>Bruce</td><td>Evans</td><td>56</td><td>153.19</td><td>23%</td><td>+9</td></tr>
564 <tr><td>A23</td><td>Mike</td><td>Peters</td><td>22</td><td>5.69</td><td>20.3%</td><td>+2</td></tr>
565 <tr><td>A55</td><td>Leslie</td><td>Kent</td><td>33</td><td>15.99</td><td>25.1%</td><td>-3</td></tr>
566 <tr><td>A3</td><td>Frank</td><td>Mint</td><td>44</td><td>12.59</td><td>44.2%</td><td>-12</td></tr>
567 <tr><td>A21</td><td>Joe</td><td>Thomas</td><td>45</td><td>15.25</td><td>44%</td><td>+12</td></tr>
568 <tr><td>A12</td><td>Tess</td><td>Evans</td><td>66</td><td>13.59</td><td>23%</td><td>+4</td></tr>
569 <tr><td>A21</td><td>Peter</td><td>Dunn</td><td>12</td><td>2.99</td><td>21.1%</td><td>+2</td></tr>
570 <tr><td>A33</td><td>Harry</td><td>Jones</td><td>13</td><td>19.49</td><td>22.2%</td><td>-6</td></tr>
571 <tr><td>A13</td><td>John</td><td>James</td><td>16</td><td>13.89</td><td>42.1%</td><td>-13</td></tr>
572 <tr><td>A71</td><td>Nick</td><td>Parker</td><td>45</td><td>13.89</td><td>44%</td><td>+29</td></tr>
573 <tr><td>A21</td><td>Charles</td><td>Dunn</td><td>19</td><td>15.49</td><td>22%</td><td>+3</td></tr>
574 </tbody>
575 </table>
576 </div>
577
578 <br>
579 <h3>Nested sticky header tables</h3>
580
581 <table id="table3" class="tablesorter">
582 <thead>
583 <tr>
584 <th>Main table header</th>
585 </tr>
586 </thead>
587 <tbody>
588 <tr>
589 <td>Main table - row 1</td>
590 </tr>
591 <tr>
592 <td>Main table - row 2</td>
593 </tr>
594 <tr>
595 <td>
596 <table id="nested1" class="nested">
597 <thead>
598 <tr>
599 <th>Header for the nested table 1</th>
600 </tr>
601 <tr>
602 <th class="sorter-false">Second header row for nested table 1</th>
603 </tr>
604 </thead>
605 <tbody>
606 <tr><td>data in the nested table 1 - row 1</td></tr>
607 <tr><td>data in the nested table 1 - row 2</td></tr>
608 <tr><td>data in the nested table 1 - row 3</td></tr>
609 <tr><td>data in the nested table 1 - row 4</td></tr>
610 <tr><td>data in the nested table 1 - row 5</td></tr>
611 <tr>
612 <td>
613 <table id="nested2" class="nested">
614 <caption class="dark-row">Nested table 2 caption</caption>
615 <thead>
616 <tr>
617 <th>Header for the nested table 2</th>
618 </tr>
619 <tr>
620 <th class="sorter-false">Second header row for nested table 2</th>
621 </tr>
622 </thead>
623 <tbody>
624 <tr><td>data in the nested table 2 - row 1</td></tr>
625 <tr><td>data in the nested table 2 - row 2</td></tr>
626 <tr><td>data in the nested table 2 - row 3</td></tr>
627 <tr><td>data in the nested table 2 - row 4</td></tr>
628 <tr><td>data in the nested table 2 - row 5</td></tr>
629 <tr><td>data in the nested table 2 - row 6</td></tr>
630 <tr><td>data in the nested table 2 - row 7</td></tr>
631 <tr><td>data in the nested table 2 - row 8</td></tr>
632 <tr><td>data in the nested table 2 - row 9</td></tr>
633 <tr><td>data in the nested table 2 - row 10</td></tr>
634 <tr><td>data in the nested table 2 - row 11</td></tr>
635 <tr><td>data in the nested table 2 - row 12</td></tr>
636 <tr><td>data in the nested table 2 - row 13</td></tr>
637 <tr><td>data in the nested table 2 - row 14</td></tr>
638 <tr><td>data in the nested table 2 - row 15</td></tr>
639 <tr><td>data in the nested table 2 - row 16</td></tr>
640 <tr><td>data in the nested table 2 - row 17</td></tr>
641 <tr><td>data in the nested table 2 - row 18</td></tr>
642 <tr><td>data in the nested table 2 - row 19</td></tr>
643 <tr><td>data in the nested table 2 - row 20</td></tr>
644 </tbody>
645 </table>
646 </td>
647 </tr>
648 <tr><td>data in the nested table 1 - row 6</td></tr>
649 <tr><td>data in the nested table 1 - row 7</td></tr>
650 <tr><td>data in the nested table 1 - row 8</td></tr>
651 <tr><td>data in the nested table 1 - row 9</td></tr>
652 <tr><td>data in the nested table 1 - row 10</td></tr>
653 <tr><td>data in the nested table 1 - row 11</td></tr>
654 <tr><td>data in the nested table 1 - row 12</td></tr>
655 <tr><td>data in the nested table 1 - row 13</td></tr>
656 <tr><td>data in the nested table 1 - row 14</td></tr>
657 <tr><td>data in the nested table 1 - row 15</td></tr>
658 <tr><td>data in the nested table 1 - row 16</td></tr>
659 <tr><td>data in the nested table 1 - row 17</td></tr>
660 <tr><td>data in the nested table 1 - row 18</td></tr>
661 <tr><td>data in the nested table 1 - row 19</td></tr>
662 <tr><td>data in the nested table 1 - row 20</td></tr>
663 </tbody>
664 </table>
665 </td>
666 </tr>
667 <tr>
668 <td>Main table - row 3</td>
669 </tr>
670 <tr>
671 <td>
672 <table id="nested3" class="nested">
673 <caption class="dark-row">Nested table 3 caption</caption>
674 <thead>
675 <tr>
676 <th>Header for the nested table 3</th>
677 </tr>
678 </thead>
679 <tbody>
680 <tr><td>data in the nested table 3 - row 1</td></tr>
681 <tr><td>data in the nested table 3 - row 2</td></tr>
682 <tr><td>data in the nested table 3 - row 3</td></tr>
683 <tr><td>data in the nested table 3 - row 4</td></tr>
684 <tr><td>data in the nested table 3 - row 5</td></tr>
685 <tr><td>data in the nested table 3 - row 6</td></tr>
686 <tr><td>data in the nested table 3 - row 7</td></tr>
687 <tr><td>data in the nested table 3 - row 8</td></tr>
688 <tr><td>data in the nested table 3 - row 9</td></tr>
689 <tr><td>data in the nested table 3 - row 10</td></tr>
690 <tr><td>data in the nested table 3 - row 11</td></tr>
691 <tr><td>data in the nested table 3 - row 12</td></tr>
692 <tr><td>data in the nested table 3 - row 13</td></tr>
693 <tr><td>data in the nested table 3 - row 14</td></tr>
694 <tr><td>data in the nested table 3 - row 15</td></tr>
695 <tr><td>data in the nested table 3 - row 16</td></tr>
696 <tr><td>data in the nested table 3 - row 17</td></tr>
697 <tr><td>data in the nested table 3 - row 18</td></tr>
698 <tr><td>data in the nested table 3 - row 19</td></tr>
699 <tr><td>data in the nested table 3 - row 20</td></tr>
700 </tbody>
701 </table>
702 </td>
703 </tr>
704 <tr>
705 <td>Main table - row 4</td>
706 </tr>
707 </tbody>
708 </table>
709
710 <div class="spacer"></div>
711 <div class="next-up">
712 <hr />
713 Next up: <a href="example-widget-zebra.html">Zebra stripe widget &rsaquo;&rsaquo;</a>
714 </div>
715
716 </div>
717
718 </body>
719 </html>