forked from TFMM/silent-auction
fix: revert to localeCompare numeric:true for natural sorting
This commit is contained in:
@@ -22,12 +22,7 @@
|
|||||||
field: 'text',
|
field: 'text',
|
||||||
direction: 'asc',
|
direction: 'asc',
|
||||||
func: function(a, b) {
|
func: function(a, b) {
|
||||||
const valA = parseInt(a.text, 10);
|
return a.text.localeCompare(b.text, undefined, {numeric: true, sensitivity: 'base'});
|
||||||
const valB = parseInt(b.text, 10);
|
|
||||||
if (isNaN(valA) || isNaN(valB)) {
|
|
||||||
return a.text.localeCompare(b.text);
|
|
||||||
}
|
|
||||||
return valA - valB;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user