フロントエンドthymeleafでpagehelperを使用してページングおよびデータ表示を行う
23036 ワード
https://blog.csdn.net/weixin_41866607/article/details/104181571 https://blog.csdn.net/qq_26975307/article/details/89088577 https://blog.csdn.net/yuzhiqiang_1/article/details/100553352
注意:
コードの例:
注意:
[[${coder.user_name}]] <span th:text="${coder.user_name}">span> 。
pagehelper pageInfo prePage nextPage, , 。
thymeleaf :th:οnclick="pass([[${coder.coder_id}]])"
コードの例:
<tr th:each="coder,coderList:${pageInfo.list}">
<td><input name="ids" type="checkbox">td>
<td>
[[${coder.user_name}]]
td>
<td>[[${coder.user_name}]]td>
<td>[[${coder.user_name}]]td>
<td>[[${coder.user_name}]]td>
<td>[[${coder.user_name}]]td>
<td>[[${coder.user_name}]]td>
<td>[[${coder.user_name}]]td>
<td><span th:text="${coder.coder_classification}">span>td>
<td class="text-center">
<button type="button" class="btn bg-olive btn-xs" th:onclick="pass([[${coder.coder_id}]])"> button>
<button type="button" class="btn bg-yellow btn-xs" th:onclick="fail([[${coder.coder_id}]])"> button>
td>
tr>
<div class="pull-left">
<div class="form-group form-inline">
[[${pageInfo.pages}]] , [[${pageInfo.total}]] 。
<select class="form-control" id="changePageSize" onchange="changePageSize()">
<option value="2" th:selected="${pageInfo.size == 2}">2option>
<option value="4" th:selected="${pageInfo.size == 4}">4option>
<option value="6" th:selected="${pageInfo.size == 6}">6option>
<option value="8" th:selected="${pageInfo.size == 8}">8option>
<option value="10" th:selected="${pageInfo.size == 10}">10option>
select>
div>
div>
<div class="box-tools pull-right">
<ul class="pagination">
<li>
<a th:href="'/manage/findAll.do?page=1&size='+${pageInfo.pageSize}" aria-label="Previous"> a>
li>
<li><a th:href="'/manage/findAll.do?page='+${pageInfo.prePage}+'&size='+${pageInfo.pageSize}"> a>li>
<li th:each="nav:${pageInfo.navigatepageNums}">
<a th:href="'/manage/findAll.do?page='+${nav}+'&size='+${pageInfo.pageSize}" th:text="${nav}" th:if="${nav != pageInfo.pageNum}">a>
<span th:if="${nav == pageInfo.pageNum}" th:text="${nav}" >span>
li>
<li><a th:href="'/manage/findAll.do?page='+${pageInfo.nextPage}+'&size='+${pageInfo.pageSize}"> a>li>
<li>
<a th:href="'/manage/findAll.do?page='+${pageInfo.pages}+'&size='+${pageInfo.pageSize}" aria-label="Next"> a>
li>
ul>
div>