removed debug statements
This commit is contained in:
parent
8e0a2ff6e8
commit
47439fe358
|
@ -78,11 +78,8 @@ function deleteAddress(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortBy(column) {
|
function sortBy(column) {
|
||||||
console.log("sortby: " + column)
|
|
||||||
|
|
||||||
// switch direction on every call
|
// switch direction on every call
|
||||||
let currentSortOrder = document.getElementById(column + '_sort')
|
let currentSortOrder = document.getElementById(column + '_sort')
|
||||||
let sortOrder = 0
|
|
||||||
if (currentSortOrder.innerHTML === 'asc') {
|
if (currentSortOrder.innerHTML === 'asc') {
|
||||||
currentSortOrder.innerHTML = 'desc'
|
currentSortOrder.innerHTML = 'desc'
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,11 +90,9 @@ function sortBy(column) {
|
||||||
let dirty = true;
|
let dirty = true;
|
||||||
// loop until clean
|
// loop until clean
|
||||||
while (dirty) {
|
while (dirty) {
|
||||||
console.log('dirty', dirty)
|
|
||||||
// assume we are finished
|
// assume we are finished
|
||||||
dirty = false
|
dirty = false
|
||||||
const rows = table.rows;
|
const rows = table.rows;
|
||||||
console.log(rows)
|
|
||||||
for (let i = 1; i < (rows.length - 2); i++) {
|
for (let i = 1; i < (rows.length - 2); i++) {
|
||||||
let x = rows[i]
|
let x = rows[i]
|
||||||
let rowXId = x.id
|
let rowXId = x.id
|
||||||
|
@ -109,9 +104,6 @@ function sortBy(column) {
|
||||||
let rowYNumber = rowYId.charAt(rowYId.length -1)
|
let rowYNumber = rowYId.charAt(rowYId.length -1)
|
||||||
let valueY = document.getElementById(column + '_' + rowYNumber).value
|
let valueY = document.getElementById(column + '_' + rowYNumber).value
|
||||||
|
|
||||||
console.log(valueX, valueY)
|
|
||||||
// mind asc & desc
|
|
||||||
|
|
||||||
let currentSortOrder = document.getElementById(column + '_sort')
|
let currentSortOrder = document.getElementById(column + '_sort')
|
||||||
let sortOrder = 0
|
let sortOrder = 0
|
||||||
if (currentSortOrder.innerHTML === 'asc') {
|
if (currentSortOrder.innerHTML === 'asc') {
|
||||||
|
@ -119,12 +111,7 @@ function sortBy(column) {
|
||||||
} else {
|
} else {
|
||||||
sortOrder = -1
|
sortOrder = -1
|
||||||
}
|
}
|
||||||
console.log("cs", currentSortOrder.innerHTML)
|
|
||||||
|
|
||||||
console.log(valueX.localeCompare(valueY))
|
|
||||||
if (valueX.localeCompare(valueY) === sortOrder) {
|
if (valueX.localeCompare(valueY) === sortOrder) {
|
||||||
console.log('switch A')
|
|
||||||
// switch rows
|
|
||||||
x.parentNode.insertBefore(y, x);
|
x.parentNode.insertBefore(y, x);
|
||||||
dirty = true
|
dirty = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue