File: example-widget-reflow3.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 (125 lines) | stat: -rw-r--r-- 3,722 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
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jQuery tablesorter 2.0 - Table Reflow Widget (beta)</title>

	<!-- Demo stuff -->
	<link rel="stylesheet" href="css/jq.css">

	<!-- jQuery -->
	<script src="js/jquery-latest.min.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>
	<script src="../js/widgets/widget-reflow.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>$(function() {

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

<table id="table3">
	<thead>
		<tr>
			<th class="ui-table-reflow-ignore sorter-false">Paris</th>
			<th colspan="2">Average Temperatures (C)</th>
			<th colspan="2">Average Rainfall</th>
		</tr>
		<tr>
			<th>Month</th>
			<th>Minimum Temp</th>
			<th>Maximum Temp</th>
			<th>Precipitaion (mm)</th>
			<th>Rainfall Days</th>
		</tr>
	</thead>
	<tbody>
		<tr><th>January</th><td>3</td><td>8</td><td>17.8</td><td>10</td></tr>
		<tr><th>February</th><td>2</td><td>9</td><td>21.7</td><td>9</td></tr>
		<tr><th>March</th><td>4</td><td>13</td><td>24.2</td><td>10</td></tr>
		<tr><th>April</th><td>6</td><td>15</td><td>24.6</td><td>11</td></tr>
		<tr><th>May</th><td>10</td><td>20</td><td>26.2</td><td>10</td></tr>
		<tr><th>June</th><td>13</td><td>23</td><td>25.1</td><td>9</td></tr>
		<tr><th>July</th><td>15</td><td>25</td><td>21.7</td><td>7</td></tr>
		<tr><th>August</th><td>15</td><td>25</td><td>21.4</td><td>7</td></tr>
		<tr><th>September</th><td>11</td><td>21</td><td>15.6</td><td>8</td></tr>
		<tr><th>October</th><td>9</td><td>17</td><td>25.3</td><td>11</td></tr>
		<tr><th>November</th><td>5</td><td>11</td><td>22.4</td><td>12</td></tr>
		<tr><th>December</th><td>3</td><td>8</td><td>26.6</td><td>12</td></tr>
	</tbody>
</table>

</body>
</html>