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

	<!-- demo -->
	<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;
		}
		/* allow toggle of thead */
		thead.hide-header {
			display: none;
		}
	}
	.ui-table-reflow .ui-table-cell-label {
		display: none;
	}
	</style>
	<script>$(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'
		}
	});

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

<table id="table1">
	<thead>
		<tr>
			<th>Rank</th>
			<th>Age</th>
			<th>Total</th>
			<th>Discount</th>
			<th>Date</th>
		</tr>
	</thead>
	<tbody>
		<tr><td>1</td><td>25</td><td>$5.95</td><td>22%</td><td>Jun 26, 2013 7:22 AM</td></tr>
		<tr><td>11</td><td>12</td><td>$82.99</td><td>5%</td><td>Aug 21, 2013 12:21 PM</td></tr>
		<tr><td>12</td><td>51</td><td>$99.29</td><td>18%</td><td>Oct 13, 2013 1:15 PM</td></tr>
		<tr><td>51</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2013 8:14 AM</td></tr>
		<tr><td>21</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2012 5:14 AM</td></tr>
		<tr><td>013</td><td>18</td><td>$65.89</td><td>45%</td><td>Jan 12, 2013 11:14 AM</td></tr>
		<tr><td>005</td><td>45</td><td>$153.19</td><td>45%</td><td>Jan 18, 2014 9:12 AM</td></tr>
		<tr><td>10</td><td>3</td><td>$5.29</td><td>4%</td><td>Jan 8, 2013 5:11 PM</td></tr>
		<tr><td>16</td><td>24</td><td>$14.19</td><td>14%</td><td>Jan 14, 2014 11:23 AM</td></tr>
		<tr><td>66</td><td>22</td><td>$13.19</td><td>11%</td><td>Jan 18, 2013 9:12 AM</td></tr>
		<tr><td>100</td><td>18</td><td>$55.20</td><td>15%</td><td>Feb 12, 2013 7:23 PM</td></tr>
		<tr><td>55</td><td>65</td><td>$123.00</td><td>32%</td><td>Jan 20, 2014 1:12 PM</td></tr>
		<tr><td>9</td><td>25</td><td>$22.09</td><td>17%</td><td>Jun 11, 2013 10:55 AM</td></tr>
		<tr><td>13</td><td>12</td><td>$19.99</td><td>18%</td><td>Jan 20, 2014 7:45 PM</td></tr>
		<tr><td>73</td><td>58</td><td>$129.19</td><td>39%</td><td>Jan 20, 2014 10:11 AM</td></tr>
	</tbody>
</table>

</body>
</html>