Sort files by numeric values
This commit is contained in:
parent
b41f20f0cc
commit
5be1cd5d65
1 changed files with 4 additions and 2 deletions
|
@ -94,8 +94,10 @@ $(document).ready(function () {
|
|||
} else if (sortBy === "name") {
|
||||
console.log("sort by name");
|
||||
|
||||
var collator = new Intl.Collator([], {numeric: true});
|
||||
filesData.sort(function (fileA, fileB) {
|
||||
return fileA.name.toLowerCase().localeCompare(fileB.name.toLowerCase());
|
||||
return collator.compare(fileA.name.toLowerCase(), fileB.name.toLowerCase());
|
||||
//return fileA.name.toLowerCase().localeCompare(fileB.name.toLowerCase());
|
||||
});
|
||||
|
||||
} else if (sortBy === "size") {
|
||||
|
@ -235,4 +237,4 @@ $(document).ready(function () {
|
|||
};
|
||||
|
||||
navigateToUrlLocation();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue