Skip to content

Commit

Permalink
Fix natural sort for file size.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrsjng committed Sep 3, 2013
1 parent 19d53b4 commit f0d7ec7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/_h5ai/client/js/inc/ext/sort.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,12 +107,17 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
return res; return res;
} }


val1 = '' + getValue(item1); val1 = getValue(item1);
val2 = '' + getValue(item2); val2 = getValue(item2);


if (ignorecase) { if (isNaN(val1) || isNaN(val2)) {
val1 = val1.toLowerCase(); val1 = '' + val1;
val2 = val2.toLowerCase(); val2 = '' + val2;

if (ignorecase) {
val1 = val1.toLowerCase();
val2 = val2.toLowerCase();
}
} }


if (natural) { if (natural) {
Expand All @@ -130,7 +135,7 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
var headers = $('#items li.header a'), var headers = $('#items li.header a'),
header = $('#items li.header a.' + columnClasses[column]), 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'), current = $('#items .item'),
sorted = $('#items .item').sort(fn); sorted = $('#items .item').sort(fn);
Expand Down

0 comments on commit f0d7ec7

Please sign in to comment.