From 1ae571489d456ad1eb9d1a698d8bb863cce21397 Mon Sep 17 00:00:00 2001 From: Corban-Lee Date: Wed, 18 Sep 2024 12:17:16 +0100 Subject: [PATCH] table controls mobile friendly --- apps/static/js/table.js | 56 ++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/apps/static/js/table.js b/apps/static/js/table.js index e79c160..5ef9ffa 100644 --- a/apps/static/js/table.js +++ b/apps/static/js/table.js @@ -318,40 +318,35 @@ function createTable(containingSelector, tableId) { function createTableControls(containingSelector, pageSizeId) { $(containingSelector).append(` -
-
-
- +
+
+
-
-
- -
-
-
- +
+ +  of  +
-
`); $("#" + pageSizeId).select2({ @@ -372,17 +367,8 @@ function updateTableContainer(containerId, page, pageSize, itemsCount, totalItem nextExists, prevExists ); - updateTablePaginationInfo( - `#${containerId} .table-page-info`, - itemsCount, - totalItemsCount - ); -} -// Updates the pagination text for a given pageInfoId -function updateTablePaginationInfo(pageInfoId, showing, total) { - $(`${pageInfoId} .pageinfo-showing`).text(showing); - $(`${pageInfoId} .pageinfo-total`).text(`${total} Result${total > 1 ? "s" : ""}`); + $(`#${containerId} .pageinfo-total`).text(`${totalItemsCount} Result${totalItemsCount !== 1 ? "s" : ""}`); } // Updates the pagination buttons for a given pageControlsId