T153 Removed advanced function. Corrected JavaScript with missing semicolons that might have caused errors

This commit is contained in:
2021-01-13 17:26:32 +01:00
parent 8c3a6a9801
commit 9fbefb0256
3 changed files with 18 additions and 38 deletions

View File

@@ -27,12 +27,12 @@ document.querySelector('#btn-list-1').addEventListener('click', function() {
} else {
x.style.display = "none";
}
})
});
for (let i = 3; i >= 0; i--) {
document.querySelector('#btn-sort-' + i).addEventListener('click', function() {
addButtonListeners(i)
addButtonListeners(i);
})
}
@@ -60,20 +60,20 @@ function pagination(querySet, page, rows) {
function pageButtons(pages) {
var wrapper = document.getElementById('pagination-wrapper');
wrapper.innerHTML = ``;
var maxLeft = (state.page - Math.floor(state.window / 2))
var maxRight = (state.page + Math.ceil(state.window / 2))
var maxLeft = (state.page - Math.floor(state.window / 2));
var maxRight = (state.page + Math.ceil(state.window / 2));
if (maxLeft < 1) {
maxLeft = 1
maxRight = state.window
maxLeft = 1;
maxRight = state.window;
}
if (maxRight > pages) {
maxLeft = pages - (state.window - 1)
maxLeft = pages - (state.window - 1);
if (maxLeft < 1) {
maxLeft = 1
maxLeft = 1;
}
maxRight = pages
maxRight = pages;
}
for (var page = maxLeft; page <= maxRight; page++) {
@@ -93,12 +93,12 @@ function pageButtons(pages) {
}
$('.page').on('click', function() {
$('#table-body').empty()
$('#table-body').empty();
state.page = Number($(this).val())
state.page = Number($(this).val());
buildPage()
})
buildPage();
});
}
@@ -143,7 +143,7 @@ function showTable() {
</td>
`
}
table.append(row)
table.append(row);
}
for (var i = myList.length + 1; i <= state.rows; i++) {
var j = i + (state.page - 1) * 10;
@@ -164,7 +164,7 @@ function showTable() {
}
table.append(row)
}
pageButtons(data.pages)
pageButtons(data.pages);
}
function sortTable() {
@@ -202,8 +202,8 @@ console.log("sortTable");
}
function prepareTable() {
data = pagination(state.querySet, state.page, state.rows)
myList = data.querySet
data = pagination(state.querySet, state.page, state.rows);
myList = data.querySet;
}
function buildTable() {