| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>jQuery tablesorter 2.0 - Vertical Group Widget</title> |
| 6 |
|
| 7 |
|
| 8 |
<script src="js/jquery-latest.min.js"></script> |
| 9 |
|
| 10 |
|
| 11 |
<link rel="stylesheet" href="css/jq.css"> |
| 12 |
<link href="css/prettify.css" rel="stylesheet"> |
| 13 |
<script src="js/prettify.js"></script> |
| 14 |
<script src="js/docs.js"></script> |
| 15 |
|
| 16 |
|
| 17 |
<link rel="stylesheet" href="../css/theme.blue.css"> |
| 18 |
<script src="../js/jquery.tablesorter.js"></script> |
| 19 |
<script src="../js/parsers/parser-date-weekday.js"></script> |
| 20 |
|
| 21 |
<script src="../js/widgets/widget-vertical-group.js"></script> |
| 22 |
|
| 23 |
<style id="css">/* Required additional CSS to make this widget work */ |
| 24 |
table.tablesorter tr:not(:last-of-type) th, |
| 25 |
table.tablesorter tr:not(:last-of-type) td { |
| 26 |
/* all current themes style the bottom border; we'll switch to use the top */ |
| 27 |
border-width: 1px 1px 0 0; |
| 28 |
} |
| 29 |
table.tablesorter tr:last-of-type td:not(.tablesorter-vertical-group-hide) { |
| 30 |
/* last row gets a top & bottom border */ |
| 31 |
border-width: 1px 1px 1px 0; |
| 32 |
} |
| 33 |
.tablesorter td.tablesorter-vertical-group-hide { |
| 34 |
text-indent: -9999em; |
| 35 |
border-top-color: transparent; |
| 36 |
} |
| 37 |
/* class added to the cell in the first row of the group */ |
| 38 |
.tablesorter td.tablesorter-vertical-group-show {}</style> |
| 39 |
|
| 40 |
<script id="js">$(function() { |
| 41 |
|
| 42 |
// call the tablesorter plugin |
| 43 |
$("table").tablesorter({ |
| 44 |
theme: 'blue', |
| 45 |
widgets: ["vertical-group", "zebra"] |
| 46 |
}); |
| 47 |
|
| 48 |
});</script> |
| 49 |
</head> |
| 50 |
<body> |
| 51 |
<div id="banner"> |
| 52 |
<h1>table<em>sorter</em></h1> |
| 53 |
<h2>Vertical Group Widget</h2> |
| 54 |
<h3>Flexible client-side table sorting</h3> |
| 55 |
<a href="index.html">Back to documentation</a> |
| 56 |
</div> |
| 57 |
<div id="main"> |
| 58 |
|
| 59 |
<p class="tip"> |
| 60 |
<em>NOTE!</em> |
| 61 |
</p> |
| 62 |
<ul> |
| 63 |
<li>Widget added in <span class="version">v2.29.1</span>. Thanks to <a href="https://github.com/aavmurphy">aavmurphy</a> for sharing the code! |
| 64 |
<ul> |
| 65 |
<li>This widget works by enabling it in the <code>widgets</code> option <em>and</em> adding a <code>tablesorter-vertical-group</code> class name to the header column.</li> |
| 66 |
<li>Make sure to include the additional CSS shown on this page.</li> |
| 67 |
<li>Click to sort a column. Any sorted columns with duplicate cell entries will be grouped together and the zebra striping will be adjusted.</li> |
| 68 |
<li>Sorting multiple columns will again adjust the duplicates and zebra striping.</li> |
| 69 |
</ul> |
| 70 |
</li> |
| 71 |
</ul> |
| 72 |
|
| 73 |
<h1>Demo</h1> |
| 74 |
<div id="demo"><table class="tablesorter"> |
| 75 |
<thead> |
| 76 |
<tr> |
| 77 |
<th class="tablesorter-vertical-group sorter-weekday">Day</th> |
| 78 |
<th class="tablesorter-vertical-group">First Name</th> |
| 79 |
<th class="tablesorter-vertical-group">Last Name</th></tr> |
| 80 |
</thead> |
| 81 |
<tbody> |
| 82 |
<tr><td>Tuesday</td><td>Peter</td><td>Jones</td></tr> |
| 83 |
<tr><td>Thursday</td><td>Peter</td><td>Smith</td></tr> |
| 84 |
<tr><td>Thursday</td><td>Fred</td><td>Smith</td></tr> |
| 85 |
<tr><td>Friday</td><td>Fred</td><td>Jones</td></tr> |
| 86 |
<tr><td>Tuesday</td><td>Mike</td><td>Snow</td></tr> |
| 87 |
<tr><td>Monday</td><td>Mike</td><td>Jones</td></tr> |
| 88 |
<tr><td>Wednesday</td><td>Mike</td><td>Smith</td></tr> |
| 89 |
<tr><td>Friday</td><td>Fred</td><td>Snow</td></tr> |
| 90 |
<tr><td>Tuesday</td><td>Fred</td><td>Smith</td></tr> |
| 91 |
<tr><td>Thursday</td><td>Peter</td><td>Snow</td></tr> |
| 92 |
<tr><td>Friday</td><td>Mike</td><td>Smith</td></tr> |
| 93 |
<tr><td>Monday</td><td>Fred</td><td>Jones</td></tr> |
| 94 |
<tr><td>Tuesday</td><td>Peter</td><td>Snow</td></tr> |
| 95 |
<tr><td>Friday</td><td>Mike</td><td>Jones</td></tr> |
| 96 |
<tr><td>Wednesday</td><td>Peter</td><td>Smith</td></tr> |
| 97 |
</tbody> |
| 98 |
</table></div> |
| 99 |
|
| 100 |
<h1>Page Header</h1> |
| 101 |
<div> |
| 102 |
<pre class="prettyprint lang-html"> |
| 103 |
<link rel="stylesheet" href="css/blue/style.css"> |
| 104 |
<script src="js/jquery-latest.min.js"></script> |
| 105 |
<script src="js/jquery.tablesorter.min.js"></script> |
| 106 |
<script src="js/widgets/widget-vertical-group.min.js"></script></pre> |
| 107 |
</div> |
| 108 |
<h1>CSS</h1> |
| 109 |
<div id="css"> |
| 110 |
<pre class="prettyprint lang-css"></pre> |
| 111 |
</div> |
| 112 |
<h1>Javascript</h1> |
| 113 |
<div id="javascript"> |
| 114 |
<pre class="prettyprint lang-javascript"></pre> |
| 115 |
</div> |
| 116 |
<h1>HTML</h1> |
| 117 |
<div id="html"> |
| 118 |
<pre class="prettyprint lang-html"></pre> |
| 119 |
</div> |
| 120 |
|
| 121 |
</div> |
| 122 |
|
| 123 |
</body> |
| 124 |
</html> |