diff --git a/editablegrid_utils.js b/editablegrid_utils.js index 16d4f2a..f45406a 100644 --- a/editablegrid_utils.js +++ b/editablegrid_utils.js @@ -124,8 +124,15 @@ EditableGrid.prototype.sort_alpha = function(a,b) if (!a[0] && !b[0]) return 0; if (a[0] && !b[0]) return 1; if (!a[0] && b[0]) return -1; - if (a[0].toLowerCase()==b[0].toLowerCase()) return 0; - return a[0].toLowerCase().localeCompare(b[0].toLowerCase()); + + if (isNaN(a[0])) { + if (a[0].toLowerCase()==b[0].toLowerCase()) return 0; + return a[0].toLowerCase().localeCompare(b[0].toLowerCase()); + } else { + if (a[0] === b[0]) return 0; + if (a[0] > b[0]) return 1; + return -1; + } }; EditableGrid.prototype.sort_date = function(a,b)