diff --git a/static/js/voice-library.js b/static/js/voice-library.js index f2a09e1..07142a3 100644 --- a/static/js/voice-library.js +++ b/static/js/voice-library.js @@ -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); } } });