Reputation: 695
I'm using this great pluggin from JQuery called Tablesorter. The documentation is from https://mottie.github.io/tablesorter/docs/index.html
If I sort via SQL, I get the expected behavior like this next image:
But when I sort via the tablesorter I get a wrong behavior as it is shown in the next image:
Is There an option to allow tablesorter sorting as SQL does?
I think that the problem only appears when the content is mixed with letters and numbers, but not sure at all.
Thank you very much for the help in advance!
Upvotes: 2
Views: 47
Reputation: 86483
The problem is the first cell contains all numeric values 010844005
. So the parser detection assumes that column is to be sorted numerically.
To fix this issue, set the column to sort by text. Do this by either:
Setting a sorter-text
class in the header cell
<th class="sorter-text">Referencia</th>
Setting the headers
option for that column
$('table').tablesorter({
headers: {
0: { sorter: 'text' }
}
});
Upvotes: 3