Single-line enable or disable of next/prev buttons
This commit is contained in:
parent
4919cf0817
commit
f4f5c47320
|
@ -65,11 +65,7 @@
|
||||||
createSearchResultNode(resultToDisplay);
|
createSearchResultNode(resultToDisplay);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (currentDisplayedPage <= 1 || loading) {
|
$('#searchResultsNav-prev').disabled = (currentDisplayedPage <= 1 || loading);
|
||||||
$('#searchResultsNav-prev').disabled = true;
|
|
||||||
} else {
|
|
||||||
$('#searchResultsNav-prev').disabled = false;
|
|
||||||
}
|
|
||||||
$('#searchResultsNav-currentPage').textContent = currentDisplayedPage;
|
$('#searchResultsNav-currentPage').textContent = currentDisplayedPage;
|
||||||
|
|
||||||
let totalResultsCount = processedResults.length;
|
let totalResultsCount = processedResults.length;
|
||||||
|
@ -78,11 +74,7 @@
|
||||||
totalResultsCount += DISPLAYED_RESULTS_PER_PAGE;
|
totalResultsCount += DISPLAYED_RESULTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
const totalPageCount = Math.ceil(Math.max(1, totalResultsCount / DISPLAYED_RESULTS_PER_PAGE));
|
const totalPageCount = Math.ceil(Math.max(1, totalResultsCount / DISPLAYED_RESULTS_PER_PAGE));
|
||||||
if (currentDisplayedPage >= totalPageCount || loading) {
|
$('#searchResultsNav-next').disabled = (currentDisplayedPage >= totalPageCount || loading);
|
||||||
$('#searchResultsNav-next').disabled = true;
|
|
||||||
} else {
|
|
||||||
$('#searchResultsNav-next').disabled = false;
|
|
||||||
}
|
|
||||||
$('#searchResultsNav-totalPages').textContent = totalPageCount;
|
$('#searchResultsNav-totalPages').textContent = totalPageCount;
|
||||||
|
|
||||||
const navNode = $('#searchResultsNav');
|
const navNode = $('#searchResultsNav');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user