Sort files by numeric values
Some checks failed
Publish Docker rootless image / Push Docker image to Docker Hub (push) Failing after 1m0s
Publish Docker image / Push Docker image to Docker Hub (push) Failing after 39s

This commit is contained in:
Aroy-Art 2024-03-25 20:37:43 +01:00
parent b41f20f0cc
commit 5be1cd5d65
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -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();
});
});