mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-12 10:20:26 +00:00
parent
575c233597
commit
fb4d77ef46
@ -378,12 +378,12 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
|
|||||||
var tiddlerA = self.getTiddler(a),
|
var tiddlerA = self.getTiddler(a),
|
||||||
tiddlerB = self.getTiddler(b);
|
tiddlerB = self.getTiddler(b);
|
||||||
if(tiddlerA) {
|
if(tiddlerA) {
|
||||||
a = tiddlerA.getFieldString(sortField) || "";
|
a = tiddlerA.fields[sortField] || "";
|
||||||
} else {
|
} else {
|
||||||
a = "";
|
a = "";
|
||||||
}
|
}
|
||||||
if(tiddlerB) {
|
if(tiddlerB) {
|
||||||
b = tiddlerB.getFieldString(sortField) || "";
|
b = tiddlerB.fields[sortField] || "";
|
||||||
} else {
|
} else {
|
||||||
b = "";
|
b = "";
|
||||||
}
|
}
|
||||||
@ -395,6 +395,8 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
|
|||||||
} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {
|
} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {
|
||||||
return isDescending ? b - a : a - b;
|
return isDescending ? b - a : a - b;
|
||||||
} else if(isAlphaNumeric) {
|
} else if(isAlphaNumeric) {
|
||||||
|
a = String(a);
|
||||||
|
b = String(b);
|
||||||
return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"});
|
return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"});
|
||||||
} else {
|
} else {
|
||||||
a = String(a);
|
a = String(a);
|
||||||
|
Loading…
Reference in New Issue
Block a user