私は1つのスプリングブートアプリケーションを開発しています。私はテーブルとしてHashmapの結果セットを出力する必要があります。そのために、私はthymeleafを使ってテーブルを作りました。テーブルには時には100,000以上のレコードがあります。私はこのテーブルのページングを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>
.
.
は最近、それが1つのページ上のすべてのレコードを印刷しています。私は120レコードを確認しています。どのようにして各ページで10または50のレコードを分割できますか。私はThymeleafを使用しています。
私はdandelionデータ型を使用しようとしましたが、pom.xmlに依存関係を追加し、dandelinConfigクラスを作成しましたが、それでも結果に反映されません。
動作していません。 – Ruchita
それは動作しますが、プロジェクトにdandelion dataTables configを追加する必要があります。 – mrtasln
私は: \t \t \t com.githubを追加しました。タンポポのpom.xmlで \t \t \t のDataTable-thymeleaf \t \t \t 1.0.1 \t \t 。 –
Ruchita