I have a simple table that contains
ID and Name (FirstName + LastName) fields. Above the table I have a dropdown list with Options ID, FirstName , LastName. Based o
Maybe this is what you wanted (demo)?
HTML
<select>
<option value="-">Choose a column</option>
<option value="0">column 1c</option>
<option value="1">column 2</option>
<option value="2">column 3</option>
<option value="3">column 4</option>
</select>
<table class="tablesorter">
<!-- stuff here -->
</table>
Script
$(function(){
$('table').tablesorter();
$('select').change(function(){
var column = parseInt($(this).val(), 10),
direction = 1, // 0 = descending, 1 = ascending
sort = [[ column, direction ]];
if (column >= 0) {
$('table').trigger("sorton", [sort]);
}
});
});