This commit is contained in:
Francesco
2023-09-19 21:11:12 +02:00
parent 234f3d94c8
commit 86fecf45b7
5 changed files with 71 additions and 12 deletions

View File

@@ -49,12 +49,10 @@
<form action="" method="GET">
<!-- Reset page when applying filter to start back at page 1 -->
<!-- <input type="hidden" name="page" value="1">
<input type="hidden" name="pageSize" value="50"> -->
<input type="hidden" name="page" value="1">
<input type="hidden" name="pageSize" th:value="${queryParams.getOrDefault('pageSize', ['50'])[0]}">
<input type="hidden" name="query" th:value="${query}">
<th:block th:each="p : ${queryParams.keySet()}">
<input th:each="v : ${queryParams.get(p)}" th:name="${p}" th:value="${v}" type="hidden">
</th:block>
<div class="input-group pe-2">
<th:block th:if="${field.isForeignKey()}">
<div th:replace="~{fragments/forms :: input_autocomplete(field=${field}, value='')}">
@@ -78,6 +76,14 @@
oninput="this.setCustomValidity('')">
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
</th:block>
<th:block th:each="p : ${queryParams.keySet()}">
<input th:each="v : ${queryParams.get(p)}"
th:name="${p}" th:value="${v}" type="hidden"
th:if="${p.startsWith('filter_')}">
</th:block>
<button class="ui-btn btn btn-primary">Filter</button>
</div>
</form>

View File

@@ -179,7 +179,21 @@
</div>
</div>
<div class="d-flex align-items-center" th:if="${page.getPagination().getMaxPage() == 1}">
<div class="d-flex align-items-center" th:if="${page.getPagination().getMaxPage() == 1}">
<div class="me-3">
<form method="GET" th:action="@{|/dbadmin/model/${schema.getClassName()}|}">
<input type="hidden" th:value="${page.getPagination().getCurrentPage()}" th:name="page">
<input type="hidden" th:value="${query}" th:name="query">
<input type="hidden" name="pageSize">
<select class="form-select page-size">
<option disabled>Page size</option>
<option th:selected="${page.getPagination().getPageSize() == 50}">50</option>
<option th:selected="${page.getPagination().getPageSize() == 100}">100</option>
<option th:selected="${page.getPagination().getPageSize() == 150}">150</option>
<option th:selected="${page.getPagination().getPageSize() == 200}">200</option>
</select>
</form>
</div>
<p class="m-0 p-0">
<i>Showing [[ ${page.getActualResults()} ]] of [[ ${page.getPagination().getMaxElement()} ]] results</i>
</p>
@@ -187,7 +201,6 @@
<div class="bulk-actions">
</div>
</div>
</nav>

View File

@@ -39,9 +39,15 @@
class="ui-text-input form-control" name="query" autofocus>
<button class="ui-btn btn btn-primary">Search</button>
</div>
<th:block th:each="p : ${queryParams.keySet()}">
<input th:if="${!p.equals('query')}" th:each="v : ${queryParams.get(p)}" th:name="${p}" th:value="${v}" type="hidden">
<th:block th:each="queryParam : ${queryParams.keySet()}">
<input th:each="paramValue : ${queryParams.get(queryParam)}"
th:if="${queryParam.startsWith('filter_')}"
th:name="${queryParam}" th:value="${paramValue}" type="hidden">
</th:block>
<input type="hidden" name="page" value="1">
<input type="hidden" name="pageSize"
th:value="${queryParams.getOrDefault('pageSize', ['50'])[0]}">
</form>
<div class="separator mb-4 mt-4"></div>