游戏框架中的分页 [英] pagination in playframework
本文介绍了游戏框架中的分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Play FrameWork中实现分页,是否有任何教程或示例 我已经浏览了该网站并完成了本教程,但无法实现分页
谢谢
解决方案
我已经在play!
中使用 解决方案
I have implemented many pages in play!
using the Play pagination module. It's working fine with no issues. I'll give you an idea of what I did, below.
First I declare the ValuePaginator
that points to a result set (in my case a MYSQL
query)
ValuePaginator vpaginator=query.resultList();
Then render the Paginator instance to use it in the view
render(vpaginator);
In the view, I used the following syntax
#{paginate.list items:paginator, as:'r'}
<table>
<tr>
<td>${r[0]}</td>
<td>${r[1]}</td>
<td>${r[2]}</td>
</tr>
</table>
#{/paginate.list}
Suppose my SQL query looks like this
Select name,id,address from table
then in that case r[0]
will take the value of names, r[1]
will take the value of id's and r[2]
will take the value of addresses and render this data in 3 different columns in a table.
Hope this helps.
这篇关于游戏框架中的分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文