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
|
||||
let currentSortOrder = document.getElementById(column + '_sort')
|
||||
let currentTitleElement = document.getElementById(column)
|
||||
let currentTitle = currentTitleElement.innerHTML
|
||||
|
||||
let newTitle
|
||||
if (currentSortOrder.innerHTML === 'asc') {
|
||||
currentSortOrder.innerHTML = 'desc'
|
||||
if (currentSortOrder === 'asc') {
|
||||
currentSortOrder = 'desc'
|
||||
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇'
|
||||
} else {
|
||||
currentSortOrder.innerHTML = 'asc'
|
||||
currentSortOrder = 'asc'
|
||||
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬆'
|
||||
}
|
||||
currentTitleElement.innerHTML = newTitle
|
||||
|
@ -131,9 +130,8 @@ function sortBy(column) {
|
|||
let rowYNumber = rowYId.match(/\d+/)
|
||||
let valueY = document.getElementById(column + '_' + rowYNumber).value
|
||||
|
||||
let currentSortOrder = document.getElementById(column + '_sort')
|
||||
let sortOrder
|
||||
if (currentSortOrder.innerHTML === 'asc') {
|
||||
if (currentSortOrder === 'asc') {
|
||||
sortOrder = 1
|
||||
} else {
|
||||
sortOrder = -1
|
||||
|
@ -183,6 +181,9 @@ function closeError() {
|
|||
|
||||
}
|
||||
|
||||
// global scope
|
||||
let currentSortOrder = 'desc'
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const table = document.getElementById('address_table') || false
|
||||
if (table) {
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
<?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>
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in New Issue