From 5c035c0f40aa5f21fbf541714f48e81e532d049a Mon Sep 17 00:00:00 2001 From: Michael Cornwell Date: Sun, 2 Dec 2018 15:56:31 -0500 Subject: [PATCH] Fixed the ability to sort columns that use integers. --- editablegrid_utils.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)