fix: Resolve table header click-to-sort logic
This commit is contained in:
parent
f82a2cfb6a
commit
6f0b278bd9
@ -107,7 +107,7 @@ function toggleSortDir() {
|
||||
}
|
||||
|
||||
function syncSortHeaders() {
|
||||
document.querySelectorAll('.vl-header [data-sort]').forEach(el => {
|
||||
document.querySelectorAll('.vl-header [data-sort], .vl-table-header [data-sort]').forEach(el => {
|
||||
el.classList.remove('sort-asc', 'sort-desc');
|
||||
if (el.dataset.sort === _sortField)
|
||||
el.classList.add(_sortDir === 1 ? 'sort-asc' : 'sort-desc');
|
||||
@ -159,14 +159,8 @@ document.addEventListener('click', e => {
|
||||
const field = th.dataset.sort;
|
||||
if (field) {
|
||||
const sel = document.getElementById('voice-sort-field');
|
||||
if (sel && sel.value === field) {
|
||||
window._voiceSortDir *= -1; // toggle dir
|
||||
} else if (sel) {
|
||||
sel.value = field;
|
||||
window._voiceSortDir = 1; // default to desc for new field (or asc if you want)
|
||||
}
|
||||
readLibrarySortConfig();
|
||||
renderVoiceList();
|
||||
if (sel) sel.value = field;
|
||||
setSort(field);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user