demo The model column is not sorted properly. Just because there is an integer in the column. Someone said that I can use the complex text extraction, but I don't know how. Can anyone help me? Your great help can help
$(document).ready(function() {
// call the tablesorter plugin
$("table").tablesorter({
// define a custom text extraction function
textExtraction: function(node) {
// extract data from markup and return it
return node.childNodes[0].childNodes[0].innerHTML;
}
});
});
What's happening is that the 86
is the very first cell in the column. So the auto-detection of parsers thinks that is a numeric column. To fix it just set the column parser to text. The easiest way to do it is to add a "sorter-text" class to the header.
Because the plugin only looks at the last cell of the column in the thead, you need to add the class to the "model" cell (demo).
<thead>
<tr>
<td class='tablehover2 sorter-false' rowspan=2><a href='http://www.toyota.com.hk/cars/new_cars/index.aspx' target='_blank'> Toyota </a>
</td>
<td class='tablehover2 sorter-false'><a >Full Model List & Specifications</a>
</td>
<td class='tablehover2 sorter-false'><a> Price List</a>
</td>
</tr>
<tr>
<!-- the parsers are set by the class names in this row -->
<td class='tablehover sorter-text'>Model</td>
<td class='tablehover'>Price</td>
</tr>
</thead>
There is no need to set a textExtraction
function:
$('#tablesorter').tablesorter({
theme: 'blackice'
});