Skip to content

Instantly share code, notes, and snippets.

View jquery.sort.js
$.fn.tableSort = function (col, order){
function toNumber(number) {
return parseFloat(number.replace(/\./g,"").replace(/,/g,"."))
}
return this.each(function(){
var rows = [].slice.call(this.rows, 0).sort(function(a,b){
if (order === 'desc') b = [a,a=b][0]; // troca-troca
var textA = $(a.cells[col]).text()
, textB = $(b.cells[col]).text()
You can’t perform that action at this time.