我正在開發一個spring-boot應用程序。我必須將Hashmap結果集作爲表格打印。爲此我用百里香創造了桌子。該表有時超過10萬條記錄。我希望每10或50條記錄對此表進行分頁。百里香和春 - 桌子的分頁?
我使用thymeleaf代碼片段HTML:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:dt="http://www.thymeleaf.org/dandelion/datatables">
<head lang="en">
.
.
<div id="myDivTable">
<table class="table table-bordered" id="bomTable" id="bomTable"
dt:table="true" dt:displaylength="10">
<span th:each="row, iter : ${result}" pages:paginate="5">
<tr th:classappend="${iter.first} ? header-style">
<span th:each="cell : ${row.value}">
<td th:classappend="${#strings.contains(cell,'difference')}?set-difference-bg-color" >
<div th:switch="${cell}">
<div th:case="'Only in WC'" >
<span class="set-green-text-bold" th:text="${cell}">
</span>
</div>
<div th:case="'New in XLSX'" >
<span class="set-red-text-bold" th:text="${cell}">
</span>
</div>
<div th:case="'No'" >
<span class="set-red-text-bold" th:text="${cell}">
</span>
</div>
<div th:case="'Yes'" >
<span class="set-green-text-bold" th:text="${cell}">
</span>
</div>
<div th:case="*" >
<div th:if="${#strings.contains(cell,'difference')}">
<span
th:text="${#strings.substring(cell,0,#strings.indexOf(cell,'difference'))}">
</span>
</div>
<div th:unless="${#strings.contains(cell,'difference')}">
<span th:text="${cell}"></span>
</div>
</div>
</div>
</td>
</span>
</tr>
</span>
</table>
</div>
.
.
最近正在打印一個頁面上的所有記錄。我正在檢查120條記錄。我如何在每頁上分割10或50條記錄。我正在使用Thymeleaf。
我試圖使用蒲公英數據表,我在pom.xml中添加了依賴關係,創建了dandelinConfig類等,但它仍然沒有反映在結果中。
這是行不通的。 – Ruchita
它會工作,但你應該在你的項目中添加蒲公英dataTables配置。 – mrtasln
我已添加: \t \t \t com.github。蒲公英 \t \t \t 數據表,thymeleaf \t \t \t 1.0.1 \t \t在pom.xml中 。 –
Ruchita