fix (table): improve ux for sam/bam tables

This commit is contained in:
MickaelK 2025-06-24 22:20:39 +10:00
parent 88e4816a46
commit cdb3b8bea3
2 changed files with 9 additions and 3 deletions

View file

@ -21,6 +21,7 @@
"avi": "video/x-msvideo",
"avif": "image/avif",
"avro": "application/vnd.apache.avro",
"bam": "application/x-bam",
"bin": "application/octet-stream",
"bmp": "image/x-ms-bmp",
"bz2": "application/x-bz2",
@ -215,6 +216,7 @@
"rtf2": "text/rtf",
"run": "application/x-makeself",
"rw2": "image/x-panasonic-rw2",
"sam": "application/x-sam",
"sea": "application/x-sea",
"sew": "image/x-sew",
"sgi": "image/x-sgi",

View file

@ -238,8 +238,12 @@ function resizeLastColumnIfNeeded({ $target, $childs, padding = 0 }) {
function sortBy(rows, ascending, key) {
const o = ascending ? 1 : -1;
return rows.sort((a, b) => {
if (a[key] === b[key]) return 0;
else if (a[key] < b[key]) return -o;
return o;
let diff = a[key] - b[key];
if (isNaN(diff)) {
if (a[key] === b[key]) diff = 0;
else if (a[key] < b[key]) diff = -1;
else diff = 1;
}
return o*diff;
});
}