Tablesorter demo
All options included, as well as the uitheme widget
by Mottie
HTML
<script src="https://rawgit.com/Mottie/tablesorter/master/js/jquery.tablesorter.js"></script>
<script src="https://mottie.github.io/tablesorter/js/jquery.tablesorter.widgets.js"></script>
<link rel="stylesheet" href="https://mottie.github.io/tablesorter/css/theme.blue.css">
<table class="tablesorter">
<thead>
<tr>
<th class="sorter-float">One</th>
<th class="sorter-float">Two</th>
<th>Three</th>
</tr>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>AA</td></tr>
<tr><td>AA</td><td>2</td><td>A</td></tr>
<tr><td>2</td><td>AA</td><td>BB</td></tr>
<tr><td>BB</td><td>AAA</td><td>2</td></tr>
<tr><td>3</td><td>1</td><td>1</td></tr>
<tr><td>1</td><td>4</td><td>3</td></tr>
<tr><td>B</td><td>3</td><td>AAA</td></tr>
<tr><td>AAA</td><td>A</td><td>4</td></tr>
<tr><td>4</td><td>BB</td><td>B</td></tr>
</tbody>
</table>
CSS
.tablesorter th.sorter-float {
color: #fff;
}
JavaScript
/* Documentation for this tablesorter FORK can be found at
* http://mottie.github.io/tablesorter/docs/
* See http://stackoverflow.com/questions/39259954/custom-alphanumberic-sort-with-jquery-tablesorter
*/
$(function() {
$("table").tablesorter({
theme : 'blue',
textSorter : {
'.sorter-float' : function(a, b) {
return b.length > a.length ? -1 :
b.length < a.length ? 1 :
b.toString() > a.toString() ? -1 : 1;
}
}
});
});