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() {
|
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');
|
el.classList.remove('sort-asc', 'sort-desc');
|
||||||
if (el.dataset.sort === _sortField)
|
if (el.dataset.sort === _sortField)
|
||||||
el.classList.add(_sortDir === 1 ? 'sort-asc' : 'sort-desc');
|
el.classList.add(_sortDir === 1 ? 'sort-asc' : 'sort-desc');
|
||||||
@ -159,14 +159,8 @@ document.addEventListener('click', e => {
|
|||||||
const field = th.dataset.sort;
|
const field = th.dataset.sort;
|
||||||
if (field) {
|
if (field) {
|
||||||
const sel = document.getElementById('voice-sort-field');
|
const sel = document.getElementById('voice-sort-field');
|
||||||
if (sel && sel.value === field) {
|
if (sel) sel.value = field;
|
||||||
window._voiceSortDir *= -1; // toggle dir
|
setSort(field);
|
||||||
} else if (sel) {
|
|
||||||
sel.value = field;
|
|
||||||
window._voiceSortDir = 1; // default to desc for new field (or asc if you want)
|
|
||||||
}
|
|
||||||
readLibrarySortConfig();
|
|
||||||
renderVoiceList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user