fix: Only presort tables if sort order is specified (#5408)

Thanks to @kivinen
This commit is contained in:
Lars Eggert 2023-03-31 10:38:02 +09:00 committed by GitHub
parent 8b815fc76d
commit 50e716e440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -277,9 +277,11 @@ $(document)
const presort_col = $(header_row).children("[data-default-sort]:first");
if (presort_col) {
const order = presort_col.attr("data-default-sort");
$.each(list_instance, (i, e) => {
e.sort(presort_col.attr("data-sort"), { order: order, sortFunction: text_sort });
});
if (order == "asc" || order == "desc") {
$.each(list_instance, (i, e) => {
e.sort(presort_col.attr("data-sort"), { order: order, sortFunction: text_sort });
});
}
}
});