如何在FTL中实现分页(FreeMarker模板)
我想要我的桌子上的分页,就像
prev 1 2 3 4 5 6 Next
数字 1 2 3 ... 将取决于表中的总行就像一张桌子有38行一样,我想一次显示10行。 应显示 1 的前10行,应显示 2 的on Click of of 应显示10行, 3 接下来的10行,onclick 4 剩下的8。
我想要freemarker模板中的代码。 处理?
谁能建议如何
<#assign listOfOrders = EntityQuery.use(delegator).select("orderId").from("OrderItem").queryList()>
<table class="table table-striped" id="myTable">
<thead class="thead">
<tr>
<th scope="col">Order ID</th>
<th scope="col">No. of Products Associated</th>
</tr>
</thead>
<tbody>
<#list listOfOrders as listOrder>
<tr>
<td>
${listOfOrders[listOrder?counter - 1].orderId}<br>
</td>
<td>
<#assign order = listOfOrders[listOrder?counter - 1].orderId>
<#assign count = 0>
<#list listOfOrders as listOrder>
<#if order == listOfOrders[listOrder?counter - 1].orderId>
<#assign count = count + 1>
</#if>
</#list>
<a href="/xerus/control/ListOfProductsFtl?orderId=${listOrder.orderId}" id="view-text"> ${count} </a><br>
<#assign count = 0>
</td>
</#list>
</tr>
</tbody>
</table>
I want pagination for my table which goes like this
prev 1 2 3 4 5 6 next
the numbers 1 2 3 ... will depend on the total rows in a table, like if a table has 38 rows and I want to show 10 rows at a time.
onclick of 1 first 10 rows should be shown, onclick of 2 next 10 rows should be shown, onclick of 3 next 10 rows, onclick of 4 the remaining 8.
I want the code in freemarker template. can anyone suggest how to approach this?see pagination style
my table code is given below.
<#assign listOfOrders = EntityQuery.use(delegator).select("orderId").from("OrderItem").queryList()>
<table class="table table-striped" id="myTable">
<thead class="thead">
<tr>
<th scope="col">Order ID</th>
<th scope="col">No. of Products Associated</th>
</tr>
</thead>
<tbody>
<#list listOfOrders as listOrder>
<tr>
<td>
${listOfOrders[listOrder?counter - 1].orderId}<br>
</td>
<td>
<#assign order = listOfOrders[listOrder?counter - 1].orderId>
<#assign count = 0>
<#list listOfOrders as listOrder>
<#if order == listOfOrders[listOrder?counter - 1].orderId>
<#assign count = count + 1>
</#if>
</#list>
<a href="/xerus/control/ListOfProductsFtl?orderId=${listOrder.orderId}" id="view-text"> ${count} </a><br>
<#assign count = 0>
</td>
</#list>
</tr>
</tbody>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论