File: example-widget-sticky-header.html

package info (click to toggle)
jquery-tablesorter 1%3A2.31.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,024 kB
  • sloc: javascript: 19,496; sh: 14; makefile: 8
file content (719 lines) | stat: -rw-r--r-- 38,054 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jQuery tablesorter 2.0 - Sticky Header Widget</title>

	<!-- jQuery -->
	<script src="js/jquery-latest.min.js"></script>
	<script src="js/jquery-ui.min.js"></script>

	<!-- Demo stuff -->
	<link rel="stylesheet" href="css/jq.css">
	<link href="css/prettify.css" rel="stylesheet">
	<link rel="stylesheet" href="css/magnific-popup.css">
	<link rel="stylesheet" href="css/jquery-ui.min.css">
	<script src="js/prettify.js"></script>
	<script src="js/docs.js"></script>
	<script src="js/jquery.magnific-popup.min.js"></script>

	<!-- Tablesorter: theme -->
	<link class="theme default" rel="stylesheet" href="../css/theme.default.css">
	<link class="theme blue" rel="stylesheet" href="../css/theme.blue.css">
	<link class="theme green" rel="stylesheet" href="../css/theme.green.css">
	<link class="theme grey" rel="stylesheet" href="../css/theme.grey.css">
	<link class="theme ice" rel="stylesheet" href="../css/theme.ice.css">
	<link class="theme black-ice" rel="stylesheet" href="../css/theme.black-ice.css">
	<link class="theme dark" rel="stylesheet" href="../css/theme.dark.css">
	<link class="theme dropbox" rel="stylesheet" href="../css/theme.dropbox.css">
	<link class="theme metro-dark" rel="stylesheet" href="../css/theme.metro-dark.css">

	<style id="css">/* wrapper of table 2 */
.wrapper {
	position: relative;
	padding: 0 5px;
	height: 250px;
	overflow-y: auto;
}

/* Magnific popup */
#popup {
	position: relative;
	background: #FFF;
	padding: 20px;
	width: auto;
	max-width: 500px;
	margin: 20px auto;
}
/* Since the popup has a 20px margin, we need to adjust the wrapper position
Note:
 this is only required because we aren't actually attaching the sticky header
 to the #popup, instead we're attaching it to the .mfp-wrap because that
 element scrolls instead of the window
*/
#popup .tablesorter-sticky-wrapper {
	margin-left: 20px;
	margin-top: -20px;
}</style>

	<!-- Tablesorter script: required -->
	<script src="../js/jquery.tablesorter.js"></script>
	<script src="../js/widgets/widget-filter.js"></script>
	<script src="../js/widgets/widget-stickyHeaders.js"></script>

	<script id="js">$(function() {

	$('.open-popup-link').magnificPopup({
		type: 'inline',
		midClick: true,
		callbacks: {
			open: function () {
				// Will fire when this exact popup is opened
				// this - is Magnific Popup object
				$('#table0').tablesorter({
					theme: 'blue',
					headerTemplate : '{content} {icon}', // Add icon for various themes
					widgets: ['zebra', 'filter', 'stickyHeaders'],
					widgetOptions: {
						// jQuery selector or object to attach sticky header to
						stickyHeaders_attachTo: '.mfp-wrap',
						stickyHeaders_offset: 0,
						// caption set by demo button value
						stickyHeaders_includeCaption: includeCaption
					}
				});
			}
		}
	});

	$('#table1, .nested, #table3').tablesorter({
		widthFixed : true,
		showProcessing: true,
		headerTemplate : '{content} {icon}', // Add icon for various themes

		widgets: [ 'zebra', 'stickyHeaders', 'filter' ],

		widgetOptions: {

			// extra class name added to the sticky header row
			stickyHeaders : '',
			// number or jquery selector targeting the position:fixed element
			stickyHeaders_offset : 0,
			// added to table ID, if it exists
			stickyHeaders_cloneId : '-sticky',
			// trigger "resize" event on headers
			stickyHeaders_addResizeEvent : true,
			// if false and a caption exist, it won't be included in the sticky header
			stickyHeaders_includeCaption : true,
			// The zIndex of the stickyHeaders, allows the user to adjust this to their needs
			stickyHeaders_zIndex : 2,
			// jQuery selector or object to attach sticky header to
			stickyHeaders_attachTo : null,
			// jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window)
			stickyHeaders_xScroll : null,
			// jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window)
			stickyHeaders_yScroll : null,

			// scroll table top into view after filtering
			stickyHeaders_filteredToTop: true

			// *** REMOVED jQuery UI theme due to adding an accordion on this demo page ***
			// adding zebra striping, using content and default styles - the ui css removes the background from default
			// even and odd class names included for this demo to allow switching themes
			// , zebra   : ["ui-widget-content even", "ui-state-default odd"]
			// use uitheme widget to apply defauly jquery ui (jui) class names
			// see the uitheme demo for more details on how to change the class names
			// , uitheme : 'jui'
		}
	});

	/* make second table scroll within its wrapper */
	$('#table2').tablesorter({
		widthFixed : true,
		headerTemplate : '{content} {icon}', // Add icon for various themes

		widgets: [ 'zebra', 'stickyHeaders', 'filter' ],

		widgetOptions: {
			// jQuery selector or object to attach sticky header to
			stickyHeaders_attachTo : '.wrapper' // or $('.wrapper')
		}
	});

});</script>
<script>
$(function() {

	window.includeCaption = true;
	$('.caption').on('click', function() {
		includeCaption = !includeCaption;
		$(this).html( '' + includeCaption );
		$('#table0, #table1, #table2, #table3, .nested').each(function() {
			if (this.config) {
				this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
				this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
			}
		});
	});

	// removed jQuery UI theme because of the accordion!
	$('link.theme').each(function() { this.disabled = true; });

	var themes = 'blue default green grey ice black-ice dark dropbox metro-dark',
		i, o = '', t = themes.split(' ');
	for (i = 0; i < t.length; i++) {
		o += '<option value="' + t[i] + '">' + t[i] + '</option>';
	}

	$('select:first')
		.append(o)
		.change(function() {
			var theme = $(this).val().toLowerCase(),
				// ui-theme is added by the themeswitcher
				files = $('link.theme').each(function() {
					this.disabled = true;
				})
			files.filter('.' + theme).each(function() {
				this.disabled = false;
			});
			$('table')
				.removeClass('tablesorter-' + t.join(' tablesorter-'))
				.addClass('tablesorter-' + (theme === 'black-ice' ? 'blackice' : theme) );
		}).change();
});
</script>
</head>
<body>

<div id="banner">
	<h1>table<em>sorter</em></h1>
	<h2>Sticky Header Widget</h2>
	<h3>Flexible client-side table sorting</h3>
	<a href="index.html">Back to documentation</a>
</div>

<div id="main">

	<p></p>
	<br>

	<div id="root" class="accordion">

		<h3><a href="#">Notes</a></h3>
		<div>
			<ul>
				<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>
				<li>In <span class="version">v2.18.0</span>,
					<ul>
						<li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li>
						<li>Added <code>stickyHeaders_xScroll</code> and <code>stickyHeaders_yScroll</code> widget options.</li>
						<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>
					</ul>
					<br>
				</li>

				<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>
				<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>

				<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>
				<li>Scroll down the page to see the headers stick. Then sort the columns using the sticky headers!</li>
				<li>Multiple rows in the header, including the filter row, will become sticky.</li>

				<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>
				<li><strong>Because of the limitations of Internet Explorer version 7 and older, this widget will not work</strong>.</li>

			</ul>
		</div>

		<h3><a href="#">Options</a></h3>
		<div>
			<h4>stickyHeaders widget defaults (added inside of tablesorter <code>widgetOptions</code>)</h4>
			<div>
				<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.
			</div>
			<table class="options tablesorter-blue" data-sortlist="[[0,0]]">
				<thead>
					<tr><th>Option</th><th>Default</th><th class="sorter-false">Description</th></tr>
				</thead>
				<tbody>

					<tr id="stickyheaders">
						<td><a href="#" class="permalink">stickyHeaders</a></td>
						<td>''</td>
						<td>Include any extra class name to be added to the sticky header table (v2.1; <span class="version updated">v2.18.0</span>)
							<div class="collapsible">
							<br>
							<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>
							<br>
							Modified in <span class="version">v2.11</span> so that "tablesorter-stickyHeader" class is always added and this option only adds additional classes.
							</div>
						</td>
					</tr>

					<tr id="stickyheaders-offset">
						<td><span class="permalink">stickyHeaders_offset</span></td>
						<td>0</td>
						<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>
					</tr>

					<tr id="stickyheaders-cloneid">
						<td><a href="#" class="permalink">stickyHeaders_cloneId</a></td>
						<td>'-sticky'</td>
						<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>).
							<div class="collapsible">
								<ul>
									<li>It contains a suffix to add to any table id.</li>
									<li>Its default value is <code>-sticky</code> </li>
								</ul>
							</div>
						</td>
					</tr>

					<tr id="stickyheaders-addresizeevent">
						<td><span class="permalink">stickyHeaders_addResizeEvent</span></td>
						<td>true</td>
						<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>
					</tr>

					<tr id="stickyheaders-includecaption">
						<td><span class="permalink">stickyHeaders_includeCaption</span></td>
						<td>true</td>
						<td>If <code>false</code> and a table caption exist, it won't be included in the sticky header.</td>
					</tr>

					<tr id="stickyheaders-zindex">
						<td><span class="permalink">stickyHeaders_zIndex</span></td>
						<td>2</td>
						<td>Adjust the zIndex of the stickyHeaders element as desired.</td>
					</tr>

					<tr id="stickyheaders-attachto">
						<td><a href="#" class="permalink">stickyHeaders_attachTo</a></td>
						<td>null</td>
						<td>Set this option as a jQuery selector or object where the sticky header will be attached (<span class="version">v2.14.4</span>).
							<div class="collapsible">
							<ul>
								<li>Setting this option with either a jQuery selector string (<code>&quot;.wrapper&quot;</code>) or jQuery object (<code>$(&quot;.wrapper&quot;)</code>).</li>
								<li>This option contains the target to which the sticky header will attach - see the <a href="#table2">second example</a> below.</li>
							</ul>
							</div>
						</td>
					</tr>

					<tr id="stickyheaders-filteredtotop">
						<td><a href="#" class="permalink">stickyHeaders_filteredToTop</a></td>
						<td>true</td>
						<td>Scroll table top into view after filtering (<span class="version updated">v2.16.2</span>)
							<div class="collapsible">
							<br>
							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.
							</div>
						</td>
					</tr>

					<tr id="stickyheaders-xscroll">
						<td><a href="#" class="permalink">stickyHeaders_xScroll</a></td>
						<td>null</td>
						<td>jQuery selector or object that will be used to monitor horizontal scroll position(<span class="version">v2.18.0</span>)
							<div class="collapsible">
								<br>
								Defaults: xScroll > attachTo > window<br>
								<br>
								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.
							</div>
						</td>
					</tr>

					<tr id="stickyheaders-yscroll">
						<td><a href="#" class="permalink">stickyHeaders_yScroll</a></td>
						<td>null</td>
						<td>jQuery selector or object that will be used to monitor vertical scroll position (<span class="version">v2.18.0</span>)
							<div class="collapsible">
								<br>
								Defaults: yScroll > attachTo > window<br>
								<br>
								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.
							</div>
						</td>
					</tr>

				</tbody>
			</table>
		</div>

		<h3><a href="#">Change log</a></h3>
		<div>
			<ul>
				<li><span class="version">v2.18.0</span>:
					<ul>
						<li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li>
						<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>
						<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:
							<ul>
								<li><code>index</code> - header cell index; this is <em>not</em> the column index!</li>
								<li><code>config</code> - the <code>table.config</code> settings for the table.</li>
								<li><code>$table</code> - the target of this parameter changes:
									<ul>
										<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>
										<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>
									</ul>
								</li>
							</ul>
							<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.
						</li>
						<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>
						<br>
						</li>
					</ul>
				</li>
				<li><span class="version">v2.14.4</span>: Added <code>cssStickyHeaders_attachTo</code> option (default set to <code>null</code>).
					<ul>
						<li>Setting this option with either a jQuery selector string (<code>&quot;.wrapper&quot;</code>) or jQuery object (<code>$(&quot;.wrapper&quot;)</code>).</li>
						<li>This option contains the target to which the sticky header will attach - see the <a href="#table2">second example</a> below.</li>
					</ul>
				</li>
				<li>v2.9:
					<ul>
						<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>
						<li>Added a widget option named <code>stickyHeaders_cloneId</code>
							<ul>
								<li>It contains a suffix to add to any table id.</li>
								<li>Its default value is <code>-sticky</code> </li>
							</ul>
						</li>
						<li>Table captions and any additional rows (filter widget row) will also be included in the sticky header.</li>
					</ul>
				</li>
				<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>
				<li>v2.1.18: Add the class name <code>sticky-false</code> to any header rows you don't want to become sticky.</li>
				<li>v2.1.17: Multiple rows in the header will become sticky.</li>
				<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>
			</ul>
		</div>

	</div>

	<h1>CSS</h1>
	<div id="css">
		<pre class="prettyprint lang-css"></pre>
	</div>

	<h1>Javascript</h1>
	<div id="javascript">
		<pre class="prettyprint lang-javascript"></pre>
	</div>

	<h1>Demo</h1>
	Choose Theme:
	<select></select>
	<p></p>
	Include Caption: <button type="button" class="caption">true</button>
	<p></p>

	<h3>Sticky headers in a popup window</h3>
	<ul>
		<li><a href="#popup" class="open-popup-link">Show table in Magnific popup window</a></li>
		<li><a class="external" href="http://jsfiddle.net/Mottie/8j08gbzb/">Show table in jQuery UI Dialog</a></li>
		<li><a class="external" href="http://jsfiddle.net/Mottie/Leyaxm70/">Show table in Bootstrap Modal</a></li>
	</ul>

	<div id="popup" class="white-popup mfp-hide">
		<table id="table0" class="tablesorter">
		<caption>Student Grades</caption>
		<thead>
			<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>
		</thead>
		<tfoot>
			<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</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></tr>
			<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
			<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
			<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
			<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
			<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
			<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
			<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
			<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
			<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
			<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
			<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
			<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
			<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
			<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
			<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
			<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
			<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
			<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
			<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
			<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
			<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
			<tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
			<tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
			<tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
			<tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
			<tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
			<tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
			<tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
			<tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
			<tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
			<tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
			<tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
			<tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
			<tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
			<tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
			<tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
			<tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
			<tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
			<tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
			<tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
			<tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
			<tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
			<tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
			<tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
			<tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
			<tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
			<tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
			<tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
			<tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
			<tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
		</tbody>
		</table>
	</div>

	<h3>Attach sticky header to browser window</h3>
	<table id="table1" class="tablesorter">
	<caption class="dark-row">Student Grades</caption> <!-- dark-row used by metro-dark theme to make the header row darker -->
	<thead>
		<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>
	</thead>
	<tfoot>
		<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</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></tr>
		<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
		<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
		<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
		<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
		<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
		<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
		<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
		<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
		<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
		<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
		<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
		<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
		<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
		<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
		<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
		<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
		<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
		<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
		<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
		<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
		<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
		<tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
		<tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
		<tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
		<tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
		<tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
		<tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
		<tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
		<tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
		<tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
		<tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
		<tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
		<tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
		<tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
		<tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
		<tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
		<tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
		<tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
		<tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
		<tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
		<tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
		<tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
		<tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
		<tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
		<tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
		<tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
		<tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
		<tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
		<tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
		<tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
	</tbody>
	</table>

	<br>

	<h3>Attach sticky header to its parent</h3>
	<div class="narrow-block wrapper">
	<table id="table2" class="tablesorter">
		<caption class="dark-row">Student Grades</caption>
		<thead>
			<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>
		</thead>
		<tbody>
			<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>
			<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>
			<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>
			<tr><td>A11</td><td>Bruce</td><td>Almighty</td><td>45</td><td>153.19</td><td>44%</td><td>+19</td></tr>
			<tr><td>A102</td><td>Bruce</td><td>Evans</td><td>56</td><td>153.19</td><td>23%</td><td>+9</td></tr>
			<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>
			<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>
			<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>
			<tr><td>A21</td><td>Joe</td><td>Thomas</td><td>45</td><td>15.25</td><td>44%</td><td>+12</td></tr>
			<tr><td>A12</td><td>Tess</td><td>Evans</td><td>66</td><td>13.59</td><td>23%</td><td>+4</td></tr>
			<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>
			<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>
			<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>
			<tr><td>A71</td><td>Nick</td><td>Parker</td><td>45</td><td>13.89</td><td>44%</td><td>+29</td></tr>
			<tr><td>A21</td><td>Charles</td><td>Dunn</td><td>19</td><td>15.49</td><td>22%</td><td>+3</td></tr>
		</tbody>
	</table>
	</div>

	<br>
	<h3>Nested sticky header tables</h3>

	<table id="table3" class="tablesorter">
		<thead>
			<tr>
				<th>Main table header</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>Main table - row 1</td>
			</tr>
			<tr>
				<td>Main table - row 2</td>
			</tr>
			<tr>
				<td>
					<table id="nested1" class="nested">
						<thead>
							<tr>
								<th>Header for the nested table 1</th>
							</tr>
							<tr>
								<th class="sorter-false">Second header row for nested table 1</th>
							</tr>
						</thead>
						<tbody>
							<tr><td>data in the nested table 1 - row 1</td></tr>
							<tr><td>data in the nested table 1 - row 2</td></tr>
							<tr><td>data in the nested table 1 - row 3</td></tr>
							<tr><td>data in the nested table 1 - row 4</td></tr>
							<tr><td>data in the nested table 1 - row 5</td></tr>
							<tr>
								<td>
									<table id="nested2" class="nested">
										<caption class="dark-row">Nested table 2 caption</caption>
										<thead>
											<tr>
												<th>Header for the nested table 2</th>
											</tr>
											<tr>
												<th class="sorter-false">Second header row for nested table 2</th>
											</tr>
										</thead>
										<tbody>
											<tr><td>data in the nested table 2 - row 1</td></tr>
											<tr><td>data in the nested table 2 - row 2</td></tr>
											<tr><td>data in the nested table 2 - row 3</td></tr>
											<tr><td>data in the nested table 2 - row 4</td></tr>
											<tr><td>data in the nested table 2 - row 5</td></tr>
											<tr><td>data in the nested table 2 - row 6</td></tr>
											<tr><td>data in the nested table 2 - row 7</td></tr>
											<tr><td>data in the nested table 2 - row 8</td></tr>
											<tr><td>data in the nested table 2 - row 9</td></tr>
											<tr><td>data in the nested table 2 - row 10</td></tr>
											<tr><td>data in the nested table 2 - row 11</td></tr>
											<tr><td>data in the nested table 2 - row 12</td></tr>
											<tr><td>data in the nested table 2 - row 13</td></tr>
											<tr><td>data in the nested table 2 - row 14</td></tr>
											<tr><td>data in the nested table 2 - row 15</td></tr>
											<tr><td>data in the nested table 2 - row 16</td></tr>
											<tr><td>data in the nested table 2 - row 17</td></tr>
											<tr><td>data in the nested table 2 - row 18</td></tr>
											<tr><td>data in the nested table 2 - row 19</td></tr>
											<tr><td>data in the nested table 2 - row 20</td></tr>
										</tbody>
									</table>
								</td>
							</tr>
							<tr><td>data in the nested table 1 - row 6</td></tr>
							<tr><td>data in the nested table 1 - row 7</td></tr>
							<tr><td>data in the nested table 1 - row 8</td></tr>
							<tr><td>data in the nested table 1 - row 9</td></tr>
							<tr><td>data in the nested table 1 - row 10</td></tr>
							<tr><td>data in the nested table 1 - row 11</td></tr>
							<tr><td>data in the nested table 1 - row 12</td></tr>
							<tr><td>data in the nested table 1 - row 13</td></tr>
							<tr><td>data in the nested table 1 - row 14</td></tr>
							<tr><td>data in the nested table 1 - row 15</td></tr>
							<tr><td>data in the nested table 1 - row 16</td></tr>
							<tr><td>data in the nested table 1 - row 17</td></tr>
							<tr><td>data in the nested table 1 - row 18</td></tr>
							<tr><td>data in the nested table 1 - row 19</td></tr>
							<tr><td>data in the nested table 1 - row 20</td></tr>
						</tbody>
					</table>
				</td>
			</tr>
			<tr>
				<td>Main table - row 3</td>
			</tr>
			<tr>
				<td>
					<table id="nested3" class="nested">
						<caption class="dark-row">Nested table 3 caption</caption>
						<thead>
							<tr>
								<th>Header for the nested table 3</th>
							</tr>
						</thead>
						<tbody>
							<tr><td>data in the nested table 3 - row 1</td></tr>
							<tr><td>data in the nested table 3 - row 2</td></tr>
							<tr><td>data in the nested table 3 - row 3</td></tr>
							<tr><td>data in the nested table 3 - row 4</td></tr>
							<tr><td>data in the nested table 3 - row 5</td></tr>
							<tr><td>data in the nested table 3 - row 6</td></tr>
							<tr><td>data in the nested table 3 - row 7</td></tr>
							<tr><td>data in the nested table 3 - row 8</td></tr>
							<tr><td>data in the nested table 3 - row 9</td></tr>
							<tr><td>data in the nested table 3 - row 10</td></tr>
							<tr><td>data in the nested table 3 - row 11</td></tr>
							<tr><td>data in the nested table 3 - row 12</td></tr>
							<tr><td>data in the nested table 3 - row 13</td></tr>
							<tr><td>data in the nested table 3 - row 14</td></tr>
							<tr><td>data in the nested table 3 - row 15</td></tr>
							<tr><td>data in the nested table 3 - row 16</td></tr>
							<tr><td>data in the nested table 3 - row 17</td></tr>
							<tr><td>data in the nested table 3 - row 18</td></tr>
							<tr><td>data in the nested table 3 - row 19</td></tr>
							<tr><td>data in the nested table 3 - row 20</td></tr>
						</tbody>
					</table>
				</td>
			</tr>
			<tr>
				<td>Main table - row 4</td>
			</tr>
		</tbody>
	</table>

	<div class="spacer"></div>
	<div class="next-up">
		<hr />
		Next up: <a href="example-widget-zebra.html">Zebra stripe widget &rsaquo;&rsaquo;</a>
	</div>

</div>

</body>
</html>