我正在开发一个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