| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Table Reflow Widget (beta)</title> |
| 6 |
|
| 7 |
|
| 8 |
<link rel="stylesheet" href="css/jq.css"> |
| 9 |
|
| 10 |
|
| 11 |
<script src="js/jquery-latest.min.js"></script> |
| 12 |
|
| 13 |
|
| 14 |
<link rel="stylesheet" href="../css/theme.blue.css"> |
| 15 |
<script src="../js/jquery.tablesorter.js"></script> |
| 16 |
<script src="../js/jquery.tablesorter.widgets.js"></script> |
| 17 |
<script src="../js/widgets/widget-reflow.js"></script> |
| 18 |
|
| 19 |
<style> |
| 20 |
/* REQUIRED CSS: change your reflow breakpoint here (35em below) */ |
| 21 |
@media ( max-width: 35em ) { |
| 22 |
.ui-table-reflow td, |
| 23 |
.ui-table-reflow th { |
| 24 |
-webkit-box-sizing: border-box; |
| 25 |
-moz-box-sizing: border-box; |
| 26 |
box-sizing: border-box; |
| 27 |
float: right; |
| 28 |
/* if not using the stickyHeaders widget (not the css3 version) |
| 29 |
* the "!important" flag, and "height: auto" can be removed */ |
| 30 |
width: 100% !important; |
| 31 |
height: auto !important; |
| 32 |
} |
| 33 |
/* reflow widget */ |
| 34 |
.ui-table-reflow tbody td[data-title]:before { |
| 35 |
color: #469; |
| 36 |
font-size: .9em; |
| 37 |
content: attr(data-title); |
| 38 |
float: left; |
| 39 |
width: 50%; |
| 40 |
white-space: pre-wrap; |
| 41 |
text-align: bottom; |
| 42 |
display: inline-block; |
| 43 |
} |
| 44 |
/* reflow2 widget */ |
| 45 |
table.ui-table-reflow .ui-table-cell-label.ui-table-cell-label-top { |
| 46 |
display: block; |
| 47 |
padding: .4em 0; |
| 48 |
margin: .4em 0; |
| 49 |
text-transform: uppercase; |
| 50 |
font-size: .9em; |
| 51 |
font-weight: 400; |
| 52 |
} |
| 53 |
table.ui-table-reflow .ui-table-cell-label { |
| 54 |
padding: .4em; |
| 55 |
min-width: 30%; |
| 56 |
display: inline-block; |
| 57 |
margin: -.4em 1em -.4em -.4em; |
| 58 |
} |
| 59 |
/* allow toggle of thead */ |
| 60 |
thead.hide-header { |
| 61 |
display: none; |
| 62 |
} |
| 63 |
} |
| 64 |
.ui-table-reflow .ui-table-cell-label { |
| 65 |
display: none; |
| 66 |
} |
| 67 |
</style> |
| 68 |
|
| 69 |
<script>$(function() { |
| 70 |
|
| 71 |
// reflow2 widget (table with multiple header rows) |
| 72 |
$("#table3").tablesorter({ |
| 73 |
theme: 'blue', |
| 74 |
widgets: ['zebra', 'reflow2'], |
| 75 |
widgetOptions: { |
| 76 |
// class name added to make it responsive (class name within media query) |
| 77 |
reflow2_className : 'ui-table-reflow', |
| 78 |
// ignore header cell content with this class name |
| 79 |
reflow2_classIgnore : 'ui-table-reflow-ignore', |
| 80 |
// header attribute containing modified header name |
| 81 |
reflow2_headerAttrib : 'data-name', |
| 82 |
// class name applied to thead labels |
| 83 |
reflow2_labelClass : 'ui-table-cell-label', |
| 84 |
// class name applied to first row thead label |
| 85 |
reflow2_labelTop : 'ui-table-cell-label-top' |
| 86 |
} |
| 87 |
}); |
| 88 |
|
| 89 |
});</script> |
| 90 |
</head> |
| 91 |
<body> |
| 92 |
|
| 93 |
<table id="table3"> |
| 94 |
<thead> |
| 95 |
<tr> |
| 96 |
<th class="ui-table-reflow-ignore sorter-false">Paris</th> |
| 97 |
<th colspan="2">Average Temperatures (C)</th> |
| 98 |
<th colspan="2">Average Rainfall</th> |
| 99 |
</tr> |
| 100 |
<tr> |
| 101 |
<th>Month</th> |
| 102 |
<th>Minimum Temp</th> |
| 103 |
<th>Maximum Temp</th> |
| 104 |
<th>Precipitaion (mm)</th> |
| 105 |
<th>Rainfall Days</th> |
| 106 |
</tr> |
| 107 |
</thead> |
| 108 |
<tbody> |
| 109 |
<tr><th>January</th><td>3</td><td>8</td><td>17.8</td><td>10</td></tr> |
| 110 |
<tr><th>February</th><td>2</td><td>9</td><td>21.7</td><td>9</td></tr> |
| 111 |
<tr><th>March</th><td>4</td><td>13</td><td>24.2</td><td>10</td></tr> |
| 112 |
<tr><th>April</th><td>6</td><td>15</td><td>24.6</td><td>11</td></tr> |
| 113 |
<tr><th>May</th><td>10</td><td>20</td><td>26.2</td><td>10</td></tr> |
| 114 |
<tr><th>June</th><td>13</td><td>23</td><td>25.1</td><td>9</td></tr> |
| 115 |
<tr><th>July</th><td>15</td><td>25</td><td>21.7</td><td>7</td></tr> |
| 116 |
<tr><th>August</th><td>15</td><td>25</td><td>21.4</td><td>7</td></tr> |
| 117 |
<tr><th>September</th><td>11</td><td>21</td><td>15.6</td><td>8</td></tr> |
| 118 |
<tr><th>October</th><td>9</td><td>17</td><td>25.3</td><td>11</td></tr> |
| 119 |
<tr><th>November</th><td>5</td><td>11</td><td>22.4</td><td>12</td></tr> |
| 120 |
<tr><th>December</th><td>3</td><td>8</td><td>26.6</td><td>12</td></tr> |
| 121 |
</tbody> |
| 122 |
</table> |
| 123 |
|
| 124 |
</body> |
| 125 |
</html> |