removed sort indicator from html table

This commit is contained in:
tracer 2022-10-29 14:06:56 +02:00
parent dc78e203ea
commit 1541d05715
1 changed files with 7 additions and 6 deletions

View File

@ -99,16 +99,15 @@ function sortBy(column) {
) )
// switch direction on every call // switch direction on every call
let currentSortOrder = document.getElementById(column + '_sort')
let currentTitleElement = document.getElementById(column) let currentTitleElement = document.getElementById(column)
let currentTitle = currentTitleElement.innerHTML let currentTitle = currentTitleElement.innerHTML
let newTitle let newTitle
if (currentSortOrder.innerHTML === 'asc') { if (currentSortOrder === 'asc') {
currentSortOrder.innerHTML = 'desc' currentSortOrder = 'desc'
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇'
} else { } else {
currentSortOrder.innerHTML = 'asc' currentSortOrder = 'asc'
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬆' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬆'
} }
currentTitleElement.innerHTML = newTitle currentTitleElement.innerHTML = newTitle
@ -131,9 +130,8 @@ function sortBy(column) {
let rowYNumber = rowYId.match(/\d+/) let rowYNumber = rowYId.match(/\d+/)
let valueY = document.getElementById(column + '_' + rowYNumber).value let valueY = document.getElementById(column + '_' + rowYNumber).value
let currentSortOrder = document.getElementById(column + '_sort')
let sortOrder let sortOrder
if (currentSortOrder.innerHTML === 'asc') { if (currentSortOrder === 'asc') {
sortOrder = 1 sortOrder = 1
} else { } else {
sortOrder = -1 sortOrder = -1
@ -183,6 +181,9 @@ function closeError() {
} }
// global scope
let currentSortOrder = 'desc'
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const table = document.getElementById('address_table') || false const table = document.getElementById('address_table') || false
if (table) { if (table) {