JSFiddle - React, Tailwind, and code Playground
by dhana36
HTML
<script src="http://tablesorter.com/jquery-latest.js"></script>
<script src="http://tablesorter.com/__jquery.tablesorter.min.js"></script>
<link rel="stylesheet" href="http://tablesorter.com/themes/blue/style.css">
<table class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Due</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.frank.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>[email protected]</td>
<td>$100.00</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Conway</td>
<td>Tim</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.timconway.com</td>
</tr>
</tbody>
</table>
JavaScript
$('.tablesorter').tablesorter({
// *** Appearance ***
// fix the column widths
widthFixed : true,
// include zebra and any other widgets, options:
// 'uitheme', 'filter', 'stickyHeaders' & 'resizable'
// the 'columns' widget will require custom css for the
// primary, secondary and tertiary columns
widgets : [ 'uitheme', 'zebra' ],
// other options: "ddmmyyyy" & "yyyymmdd"
dateFormat : "mmddyyyy",
// *** Functionality ***
// starting sort direction "asc" or "desc"
sortInitialOrder : "asc",
// These are detected by default,
// but you can change or disable them
headers : {
// set "sorter : false" (no quotes) to disable the column
0: { sorter: "text" },
1: { sorter: "digit" },
2: { sorter: "text" },
3: { sorter: "url" }
},
// extract text from the table - this is how is
// it done by default
textExtraction : {
0: function(node) { return $(node).text(); },
1: function(node) { return $(node).text(); }
},
// forces the user to have this/these column(s) sorted first
sortForce : null,
// initial sort order of the columns
// [[columnIndex, sortDirection], ... ]
sortList : [[0,3]],
// default sort that is added to the end of the users sort
// selection.
sortAppend : null,
// Use built-in javascript sort - may be faster, but does not
// sort alphanumerically
sortLocaleCompare : false,
// Setting this option to true will allow you to click on the
// table header a third time to reset the sort direction.
sortReset: false,
// Setting this option to true will start the sort with the
// sortInitialOrder when clicking on a previously unsorted column.
sortRestart: false,
// The key used to select more than one column for multi-column
// sorting.
sortMultiSortKey : "shiftKey",
// *** Customize header ***
onRenderHeader : function() {
// the...