tablesorter/docs/example-widget-reflow1.html

104 lines
3.4 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery plugin: 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>