mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
137 lines
3.4 KiB
HTML
137 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>jQuery plugin: Tablesorter 2.0 - Dealing with markup inside cells</title>
|
|
|
|
<!-- jQuery -->
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
|
|
|
|
<!-- Demo stuff -->
|
|
<link rel="stylesheet" href="css/jq.css">
|
|
<script src="js/chili/jquery.chili-2.2.js"></script>
|
|
<script src="js/chili/recipes.js"></script>
|
|
<script src="js/docs.js"></script>
|
|
|
|
<!-- Tablesorter: required -->
|
|
<link rel="stylesheet" href="../css/blue/style.css">
|
|
<script src="../js/jquery.tablesorter.js"></script>
|
|
|
|
<script id="js">$(function() {
|
|
|
|
// call the tablesorter plugin
|
|
$("table").tablesorter({
|
|
|
|
/*
|
|
// define an overall custom text extraction function
|
|
textExtraction: function(node) {
|
|
return $(node).text();
|
|
}
|
|
*/
|
|
|
|
// Define a custom text extraction function for each column
|
|
// In this example, textExtraction 1-5 functions don't really need to
|
|
// be defined, since they can also be obtained using `$(node).text()`
|
|
textExtraction: {
|
|
0: function(node) { return $(node).find("strong").text(); },
|
|
1: function(node) { return $(node).find("div").text(); },
|
|
2: function(node) { return $(node).find("span").text(); },
|
|
3: function(node) { return $(node).find("em").text(); },
|
|
4: function(node) { return $(node).find("a").text(); },
|
|
5: function(node) { return $(node).find("u").text(); }
|
|
}
|
|
|
|
});
|
|
|
|
});</script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="banner">
|
|
<h1>table<strong>sorter</strong></h1>
|
|
<h2>Dealing with markup inside cells</h2>
|
|
<h3>Flexible client-side table sorting</h3>
|
|
<a href="index.html">Back to documentation</a>
|
|
</div>
|
|
|
|
<div id="main">
|
|
<p class="tip">
|
|
<em>NOTE!</em> The "First Name" column is sorting by the contents of the <strong> tag (in red).
|
|
</p>
|
|
|
|
<h1>Demo</h1>
|
|
<div id="demo"><table class="tablesorter">
|
|
<thead>
|
|
<tr>
|
|
<th>First Name</th>
|
|
<th>Last Name</th>
|
|
<th>Age</th>
|
|
<th>Total</th>
|
|
<th>Discount</th>
|
|
<th>Date</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Mr. <strong>Peter</strong></td>
|
|
<td><div>Parker</div></td>
|
|
<td><span>28</span></td>
|
|
<td><em>$9.99</em></td>
|
|
<td><a href="#">20%</a></td>
|
|
<td><u>Jul 6, 2006 8:14 AM</u></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Dr. <strong>John</strong></td>
|
|
<td><div>Hood</div></td>
|
|
<td><span>33</span></td>
|
|
<td><em>$19.99</em></td>
|
|
<td><a href="#">25%</a></td>
|
|
<td><u>Dec 10, 2002 5:14 AM</u></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Rep <strong>Clark</strong></td>
|
|
<td><div>Kent</div></td>
|
|
<td><span>18</span></td>
|
|
<td><em>$15.89</em></td>
|
|
<td><a href="#">44%</a></td>
|
|
<td><u>Jan 12, 2003 11:14 AM</u></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Rev <strong>Bruce</strong></td>
|
|
<td><div>Almighty</div></td>
|
|
<td><span>45</span></td>
|
|
<td><em>$153.19</em></td>
|
|
<td><a href="#">44%</a></td>
|
|
<td><u>Jan 18, 2001 9:12 AM</u></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Capt <strong>Bruce</strong></td>
|
|
<td><div>Evans</div></td>
|
|
<td><span>22</span></td>
|
|
<td><em>$13.19</em></td>
|
|
<td><a href="#">11%</a></td>
|
|
<td><u>Jan 18, 2007 9:12 AM</u></td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
|
|
<h1>Javascript</h1>
|
|
<div id="javascript">
|
|
<pre class="js"></pre>
|
|
</div>
|
|
<h1>HTML</h1>
|
|
<div id="html">
|
|
<pre class="html"></pre>
|
|
</div>
|
|
|
|
<div class="next-up">
|
|
<hr />
|
|
Next up: <a href="example-option-render-header.html">Advanced: Modify how the header is rendered to allow for custom styling ››</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
|