File: example-widget-reflow2.html

package info (click to toggle)
jquery-tablesorter 1%3A2.31.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,056 kB
  • sloc: javascript: 19,495; sh: 14; makefile: 8
file content (250 lines) | stat: -rw-r--r-- 8,287 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
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jQuery tablesorter 2.0 - Table Reflow Widget (beta)</title>

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

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

	<!-- Tablesorter: required -->
	<link rel="stylesheet" href="../css/theme.blue.css">
	<script src="../js/jquery.tablesorter.js"></script>
	<script src="../js/jquery.tablesorter.widgets.js"></script>

	<style>
	/* override bootstrap link colors */
	.ui-widget-content a {
		color: #428BCA;
	}
	.ui-widget-content a:hover {
		text-decoration: underline;
	}
	/*** column selector custom css only popup ***/
	.columnSelectorWrapper {
		position: relative;
		margin: 10px 0;
		display: inline-block;
	}
	.columnSelector, .hidden {
		display: none;
	}
	.columnSelectorButton {
		background: #99bfe6;
		border: #888 1px solid;
		color: #111;
		border-radius: 5px;
		padding: 5px;
	}
	#colSelect1:checked + label {
		background: #5797d7;
		border-color: #555;
	}
	#colSelect1:checked ~ #columnSelector {
		display: block;
	}
	.columnSelector {
		width: 120px;
		position: absolute;
		top: 30px;
		padding: 10px;
		background: #fff;
		border: #99bfe6 1px solid;
		border-radius: 5px;
	}
	.columnSelector label {
		display: block;
	}
	.columnSelector label:nth-child(1) {
		border-bottom: #99bfe6 solid 1px;
		margin-bottom: 5px;
	}
	.columnSelector input {
		margin-right: 5px;
	}
	.columnSelector .disabled {
		color: #ddd;
	}
	.frame-wrapper {
		max-width: 98%;
		height: 250px;
	}
	iframe {
		width: 100%;
		height: 100%;
	}
	</style>
	<script src="../js/widgets/widget-columnSelector.js"></script>

	<style>
	/* REQUIRED CSS: change your reflow breakpoint here (35em below) */
	@media ( max-width: 35em ) {
		.ui-table-reflow td,
		.ui-table-reflow th {
			-webkit-box-sizing: border-box;
			-moz-box-sizing: border-box;
			box-sizing: border-box;
			float: right;
			/* if not using the stickyHeaders widget (not the css3 version)
			 * the "!important" flag, and "height: auto" can be removed */
			width: 100% !important;
			height: auto !important;
		}
		/* reflow widget */
		.ui-table-reflow tbody td[data-title]:before {
			color: #469;
			font-size: .9em;
			content: attr(data-title);
			float: left;
			width: 50%;
			white-space: pre-wrap;
			text-align: bottom;
			display: inline-block;
		}
		/* reflow2 widget */
		table.ui-table-reflow .ui-table-cell-label.ui-table-cell-label-top {
			display: block;
			padding: .4em 0;
			margin: .4em 0;
			text-transform: uppercase;
			font-size: .9em;
			font-weight: 400;
		}
		table.ui-table-reflow .ui-table-cell-label {
			padding: .4em;
			min-width: 30%;
			display: inline-block;
			margin: -.4em 1em -.4em -.4em;
		}
		/* allow toggle of thead */
		thead.hide-header {
			display: none;
		}
	}
	.ui-table-reflow .ui-table-cell-label {
		display: none;
	}
	</style>
	<script src="../js/widgets/widget-reflow.js"></script>
	<script>
	$(function() {
		$('#table1').resizable({
			handles : 'e'
		});
	});
	</script>
	<script id="js">$(function() {

	// simple reflow widget (table with 1 header row)
	$("#table1").tablesorter({
		theme: 'blue',
		widgets: ['zebra', 'reflow'],
		widgetOptions : {
			// class name added to make it responsive (class name within media query)
			reflow_className    : 'ui-table-reflow',
			// header attribute containing modified header name
			reflow_headerAttrib : 'data-name',
			// data attribute added to each tbody cell
			// it contains the header cell text, visible upon reflow
			reflow_dataAttrib   : 'data-title'
		}
	});

	// simple reflow widget + columnSelector & stickyHeaders widgets
	$("#table2").tablesorter({
		theme: 'blue',
		widgets: ['zebra', 'reflow', 'columnSelector', 'stickyHeaders'],
		widgetOptions : {
			// target the column selector markup
			columnSelector_container : $('#columnSelector'),
			// data attribute containing column name to use in the selector container
			// make it use the same as reflow_headerAttrib
			columnSelector_name : 'data-name',

			// header attribute containing modified header name
			reflow_headerAttrib : 'data-name'
		}
	});

	// reflow2 widget (table with multiple header rows)
	$("#table3").tablesorter({
		theme: 'blue',
		widgets: ['zebra', 'reflow2'],
		widgetOptions: {
			// class name added to make it responsive (class name within media query)
			reflow2_className    : 'ui-table-reflow',
			// ignore header cell content with this class name
			reflow2_classIgnore  : 'ui-table-reflow-ignore',
			// header attribute containing modified header name
			reflow2_headerAttrib : 'data-name',
			// class name applied to thead labels
			reflow2_labelClass   : 'ui-table-cell-label',
			// class name applied to first row thead label
			reflow2_labelTop     : 'ui-table-cell-label-top'
		}
	});

});</script>
</head>
<body>

<!-- This selector markup is completely customizable -->
<div class="columnSelectorWrapper">
	<input id="colSelect1" type="checkbox" class="hidden">
	<label class="columnSelectorButton" for="colSelect1">Column</label>
	<div id="columnSelector" class="columnSelector">
		<!-- this div is where the column selector is added -->
	</div>
</div> (When "Auto" is set, the table becomes responsive; resize the browser window to see it work)

<table id="table2">
	<thead>
		<tr>
			<th data-priority="critical">Name</th>
			<th data-priority="critical">Major</th>
			<th data-priority="6" data-name="Gender">Sex</th>
			<th data-priority="4">English</th>
			<th data-priority="5">Japanese</th>
			<th data-priority="3">Calculus</th>
			<th data-priority="2">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>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>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>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>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>
	</tbody>
</table>

</body>
</html>