Compare commits

..

No commits in common. "5a805aba0765b4abe717fcbe7b305f799d32295f" and "dc78e203ea11d861421c9baa3d7ecf7fcf2c8cfb" have entirely different histories.

2 changed files with 14 additions and 7 deletions

View File

@ -99,15 +99,16 @@ 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 === 'asc') { if (currentSortOrder.innerHTML === 'asc') {
currentSortOrder = 'desc' currentSortOrder.innerHTML = 'desc'
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇'
} else { } else {
currentSortOrder = 'asc' currentSortOrder.innerHTML = 'asc'
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬆' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬆'
} }
currentTitleElement.innerHTML = newTitle currentTitleElement.innerHTML = newTitle
@ -130,8 +131,9 @@ 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 === 'asc') { if (currentSortOrder.innerHTML === 'asc') {
sortOrder = 1 sortOrder = 1
} else { } else {
sortOrder = -1 sortOrder = -1
@ -181,9 +183,6 @@ 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) {

View File

@ -33,6 +33,14 @@
</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>