mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-07-21 03:48:43 +00:00
moebius#342: Columns are not sorted correctly (Natural Sort algorithm)
Issue #31 https://github.com/MoonchildProductions/moebius/pull/342
This commit is contained in:
@@ -8,6 +8,8 @@ loader.lazyRequireGetter(this, "setNamedTimeout",
|
||||
"devtools/client/shared/widgets/view-helpers", true);
|
||||
loader.lazyRequireGetter(this, "clearNamedTimeout",
|
||||
"devtools/client/shared/widgets/view-helpers", true);
|
||||
loader.lazyRequireGetter(this, "naturalSortCaseInsensitive",
|
||||
"devtools/client/shared/natural-sort", true);
|
||||
const {KeyCodes} = require("devtools/client/shared/keycodes");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
@@ -1283,11 +1285,11 @@ Column.prototype = {
|
||||
let index;
|
||||
if (this.sorted == 1) {
|
||||
index = this.cells.findIndex(element => {
|
||||
return value < element.value;
|
||||
return naturalSortCaseInsensitive(value, element.value) === -1;
|
||||
});
|
||||
} else {
|
||||
index = this.cells.findIndex(element => {
|
||||
return value > element.value;
|
||||
return naturalSortCaseInsensitive(value, element.value) === 1;
|
||||
});
|
||||
}
|
||||
index = index >= 0 ? index : this.cells.length;
|
||||
@@ -1415,7 +1417,7 @@ Column.prototype = {
|
||||
a[this.id].textContent : a[this.id];
|
||||
let val2 = (b[this.id] instanceof Node) ?
|
||||
b[this.id].textContent : b[this.id];
|
||||
return val1 > val2;
|
||||
return naturalSortCaseInsensitive(val1, val2);
|
||||
});
|
||||
} else if (this.sorted > 1) {
|
||||
items.sort((a, b) => {
|
||||
@@ -1423,7 +1425,7 @@ Column.prototype = {
|
||||
a[this.id].textContent : a[this.id];
|
||||
let val2 = (b[this.id] instanceof Node) ?
|
||||
b[this.id].textContent : b[this.id];
|
||||
return val2 > val1;
|
||||
return naturalSortCaseInsensitive(val2, val1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user