JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://mottie.github.io/tablesorter/js/jquery.tablesorter.js"></script>
<script src="http://mottie.github.io/tablesorter/js/jquery.tablesorter.widgets.js"></script>
<link rel="stylesheet" href="http://tablesorter.com/themes/blue/style.css">
<table id="tablesorter-demo" 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>jsmith@gmail.com</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>fbach@yahoo.com</td>
<td>$50.00</td>
<td>http://www.frank.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>jdoe@hotmail.com</td>
<td>$100.00</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Conway</td>
<td>Tim</td>
<td>tconway@earthlink.net</td>
<td>$50.00</td>
<td>http://www.timconway.com</td>
</tr>
</tbody>
</table>
<a id="append" href="#">Refresh Page</a>
JavaScript
$(function() {
var $table = $("#tablesorter-demo");
$("#append").click(function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: '/echo/json/',
data: {
json: JSON.stringify({
table: '<tr> <td>Smith</td><td>Frank</td><td>fsmith@yahoo.com</td><td>$50.00</td> <td>http://www.frank.com</td></tr><tr><td>Jones</td><td>Frank</td><td>fjones@yahoo.com</td><td>$50.00</td> <td>http://www.frank.com</td></tr>',
})
},
success: function(response) {
$table
.find('tbody')
.html('')
.append(response.table);
$table.trigger("update", [true]);
}
});
/*$.get('updatetable.php', function(data) {
$table
.find('tbody')
.html('')
.append(data);
$table.trigger("update", [true]);
});*/
});
// call the tablesorter plugin
$table.tablesorter({
theme: 'blue',
// hidden filter input/selects will resize the columns, so try to minimize the change
widthFixed : true,
//sortList: [[2,0],[1,0]],
// initialize zebra striping and filter widgets
widgets: ["zebra", "filter"],
headers: { },
widgetOptions : {
// If there are child rows in the table (rows with class name from "cssChildRow" option)
// and this option is true and a match is found anywhere in the child row, then it will make that row
// visible; default is false
filter_childRows : false,
// if true, a filter will be added to the top of each table column;
// disabled by using -> headers: { 1: { filter: false } } OR add class="filter-false"
// if you set this to false, make sure you perform a search using the second method below
filter_columnFilters : true,
//...