Compare commits
2 Commits
dc78e203ea
...
5a805aba07
Author | SHA1 | Date |
---|---|---|
tracer | 5a805aba07 | |
tracer | 1541d05715 |
|
@ -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) {
|
||||||
|
|
|
@ -33,14 +33,6 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<tr style="display:none;">
|
|
||||||
<td id="first_sort">desc</td>
|
|
||||||
<td id="last_sort">desc</td>
|
|
||||||
<td id="street_sort">desc</td>
|
|
||||||
<td id="zip_sort">desc</td>
|
|
||||||
<td id="city_sort">desc</td>
|
|
||||||
<td id="phone_sort">desc</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue