mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: make sure textSorter is getting strings
This commit is contained in:
parent
8217871650
commit
3b5161a5ba
@ -1243,6 +1243,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed)
|
// Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed)
|
||||||
|
// this function will only accept strings, or you'll see "TypeError: undefined is not a function"
|
||||||
|
// I could add a = a.toString(); b = b.toString(); but it'll slow down the sort overall
|
||||||
ts.sortNatural = function(a, b) {
|
ts.sortNatural = function(a, b) {
|
||||||
if (a === b) { return 0; }
|
if (a === b) { return 0; }
|
||||||
var xN, xD, yN, yD, xF, yF, i, mx,
|
var xN, xD, yN, yD, xF, yF, i, mx,
|
||||||
|
@ -1082,7 +1082,8 @@ ts.filter = {
|
|||||||
// sort parsed select options
|
// sort parsed select options
|
||||||
cts = c.textSorter || '';
|
cts = c.textSorter || '';
|
||||||
parsed.sort(function(a, b){
|
parsed.sort(function(a, b){
|
||||||
var x = a.p, y = b.p;
|
// sortNatural breaks if you don't pass it strings
|
||||||
|
var x = a.p.toString(), y = b.p.toString();
|
||||||
if ($.isFunction(cts)) {
|
if ($.isFunction(cts)) {
|
||||||
// custom OVERALL text sorter
|
// custom OVERALL text sorter
|
||||||
return cts(x, y, true, column, table);
|
return cts(x, y, true, column, table);
|
||||||
|
Loading…
Reference in New Issue
Block a user