简体   繁体   中英

pagination in playframework

I want to implement pagination in Play FrameWork , Is there any tutorial or example for this I have explore there website and went through the tutorial but not able to implement pagination

Thanks

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.

First solution is to use the paginate-module . Furthermore there was a discussion of different implementations to solve it at google-group one result of it can find at the snippet-page . I hope that one of the solution fits to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM