Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix natural sort for file size.

  • Loading branch information...
commit f0d7ec72cf16373011d23b6f14bb633620be295c 1 parent 19d53b4
@lrsjng authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/_h5ai/client/js/inc/ext/sort.js
View
17 src/_h5ai/client/js/inc/ext/sort.js
@@ -107,12 +107,17 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
return res;
}
- val1 = '' + getValue(item1);
- val2 = '' + getValue(item2);
+ val1 = getValue(item1);
+ val2 = getValue(item2);
- if (ignorecase) {
- val1 = val1.toLowerCase();
- val2 = val2.toLowerCase();
+ if (isNaN(val1) || isNaN(val2)) {
+ val1 = '' + val1;
+ val2 = '' + val2;
+
+ if (ignorecase) {
+ val1 = val1.toLowerCase();
+ val2 = val2.toLowerCase();
+ }
}
if (natural) {
@@ -130,7 +135,7 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
var headers = $('#items li.header a'),
header = $('#items li.header a.' + columnClasses[column]),
- fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, settings.natural),
+ fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, column === 0 && settings.natural),
current = $('#items .item'),
sorted = $('#items .item').sort(fn);
Please sign in to comment.
Something went wrong with that request. Please try again.