mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
updated digit & currency parsers, added missing sortBegin - found via unit testing
This commit is contained in:
parent
075635c097
commit
64428b68e3
@ -255,7 +255,7 @@
|
||||
v = parsers[j].format(t, table, c[0].cells[j], j);
|
||||
cols.push(v);
|
||||
if ((parsers[j].type || '').toLowerCase() === "numeric") {
|
||||
colMax[j] = Math.max(Math.abs(v), colMax[j] || 0); // determine column max value (ignore sign)
|
||||
colMax[j] = Math.max(Math.abs(v) || 0, colMax[j] || 0); // determine column max value (ignore sign)
|
||||
}
|
||||
}
|
||||
cols.push(tc.cache[k].normalized.length); // add position for rowCache
|
||||
@ -690,7 +690,7 @@
|
||||
.bind('selectstart', false)
|
||||
.css({
|
||||
'user-select': 'none',
|
||||
'MozUserSelect': 'none'
|
||||
'MozUserSelect': 'none' // not needed for jQuery 1.8+
|
||||
});
|
||||
}
|
||||
// apply easy methods that trigger bound events
|
||||
@ -769,6 +769,7 @@
|
||||
updateHeaderSortCount(table, list);
|
||||
// set css for headers
|
||||
setHeadersCss(table);
|
||||
$this.trigger("sortBegin", this);
|
||||
// sort the table and append it to the dom
|
||||
multisort(table);
|
||||
appendToTable(table, init);
|
||||
@ -1293,7 +1294,8 @@
|
||||
return ts.isDigit(s);
|
||||
},
|
||||
format: function(s, table) {
|
||||
return s ? ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table) : s;
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ""), table);
|
||||
return s && typeof n === 'number' ? n : s ? $.trim( s && table.config.ignoreCase ? s.toLocaleLowerCase() : s ) : s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
@ -1304,7 +1306,8 @@
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[,. ]/g,'')); // £$€¤¥¢
|
||||
},
|
||||
format: function(s, table) {
|
||||
return s ? ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table) : s;
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ""), table);
|
||||
return s && typeof n === 'number' ? n : s ? $.trim( s && table.config.ignoreCase ? s.toLocaleLowerCase() : s ) : s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user