From 0d3691b78249182389eaf7edf0b3e1e6972bf91b Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 11 Jul 2024 10:27:34 +0100 Subject: [PATCH] handle pagination for too many pages --- apps/static/js/table.js | 72 ++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/apps/static/js/table.js b/apps/static/js/table.js index 4017968..0e23465 100644 --- a/apps/static/js/table.js +++ b/apps/static/js/table.js @@ -18,22 +18,70 @@ function updateTablePagination(pageControlsId, currentPage, pageSize, totalItems // Calculate amount of pages to account for const pages = Math.max(Math.ceil(totalItems / pageSize), 1); - // alert(pages + " " + totalItems + " " + pageSize + " ") + const maxVisiblePages = 5; - for (let i = 1; i <= pages; i++) { - let pageItem = $("
  • ").addClass("page-item"); - let pageLink = $("