From 33902a87b3f9c5080accb4aafc6f0d57841f1649 Mon Sep 17 00:00:00 2001 From: tdruez Date: Thu, 21 Dec 2023 10:07:00 -0600 Subject: [PATCH] Refine the display toggle of the pagination elements #3 Signed-off-by: tdruez --- .../product_portfolio/product_details.html | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/product_portfolio/templates/product_portfolio/product_details.html b/product_portfolio/templates/product_portfolio/product_details.html index 96fe1ce..5a38c1d 100644 --- a/product_portfolio/templates/product_portfolio/product_details.html +++ b/product_portfolio/templates/product_portfolio/product_details.html @@ -214,14 +214,26 @@ let checkPackageLink = this; checkPackageLink.classList.add("disabled"); + const tabContentPaginations = document.querySelectorAll(".tab-content .pagination"); + + function hidePagination(data) { + tabContentPaginations.forEach(function(element) { + element.style.display = 'none'; } + ); + } + + function showPagination(data) { + tabContentPaginations.forEach(function(element) { + element.style.display = ''; } + ); + } + + hidePagination(); + document.querySelectorAll("#tab_inventory tbody tr").forEach(function (row) { row.style.display = 'none'; }); - document.querySelectorAll(".tab-content .pagination").forEach(function(element) { - element.parentNode.removeChild(element); - }); - let newVersionRow = document.createElement('tr'); newVersionRow.className = 'spinner new-version'; newVersionRow.innerHTML = '' + @@ -246,6 +258,7 @@ if (!row.classList.contains("extra-details")) { row.style.display = ''; } + showPagination(); }); return false; }); @@ -255,6 +268,7 @@ if (!row.classList.contains("new-version")) { row.style.display = 'none'; } + hidePagination(); }); return false; });