every click on a column title changes the sort order
This commit is contained in:
parent
ce798e3b65
commit
8e0a2ff6e8
@ -80,6 +80,15 @@ function deleteAddress(id) {
|
||||
function sortBy(column) {
|
||||
console.log("sortby: " + column)
|
||||
|
||||
// switch direction on every call
|
||||
let currentSortOrder = document.getElementById(column + '_sort')
|
||||
let sortOrder = 0
|
||||
if (currentSortOrder.innerHTML === 'asc') {
|
||||
currentSortOrder.innerHTML = 'desc'
|
||||
} else {
|
||||
currentSortOrder.innerHTML = 'asc'
|
||||
}
|
||||
|
||||
const table = document.getElementById('address_table');
|
||||
let dirty = true;
|
||||
// loop until clean
|
||||
@ -102,7 +111,15 @@ function sortBy(column) {
|
||||
|
||||
console.log(valueX, valueY)
|
||||
// mind asc & desc
|
||||
let sortOrder = 1
|
||||
|
||||
let currentSortOrder = document.getElementById(column + '_sort')
|
||||
let sortOrder = 0
|
||||
if (currentSortOrder.innerHTML === 'asc') {
|
||||
sortOrder = 1
|
||||
} else {
|
||||
sortOrder = -1
|
||||
}
|
||||
console.log("cs", currentSortOrder.innerHTML)
|
||||
|
||||
console.log(valueX.localeCompare(valueY))
|
||||
if (valueX.localeCompare(valueY) === sortOrder) {
|
||||
|
Loading…
Reference in New Issue
Block a user