Play! framework pagination module
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with marcosnc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Adds two new tags:

#{paginate.list items:var, as:'ref'/}, which works as a drop-in replacement for #{list/} to show one page at a time
#{paginate.controls items:var /} to display the pagination controls

Also, add
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/play-pagination.css'}">
if you want to use the default stylesheet.

*Using Paginator from your Controllers*

The paginator can be used in one of three ways:

1) You can wrap the entire result set.  This is useful if the entire List is in memory already.

List<Foo> values = ...;
ValuePaginator entites = new ValuePaginator(values);

2) You can wrap the keys.  Paginator will lazily lookup the pages as they are rendered.

List<Long> keys = ... "SELECT id FROM Foo" ... ;
ModelPaginator entities = new ModelPaginator(Foo.class, keys);

3) You can supply a Play! Model and optionally a filter and let the Paginator figure out the rest.

ModelPaginator entities = new ModelPaginator(Foo.class, "foo=?", "bar");

Pagination controls are controlled by the view paginate/Controls.html and can be overridden in your project.

If the row count summary option is enabled, you can also customize paginate/RowCountSummary.html to customize
the footer (which, by default, displays the message: "Displaying rows X to Y out of Z records.").

The following properties are available to customize pagination display:

- get/setBoundaryControlsEnabled: determines whether the First and Last buttons are displayed
- get/setPagesDisplayed: customizes the number of pages that show up between the forward/backward controls
- get/setPageSize: determines the number of rows we display per page
- get/setRowCountSummaryEnabled: determines whether the row count summary view template is displayed.  By 
default, this area displays the message: "Displaying rows X to Y out of Z records."
By default, paginator uses the "page" request parameter to determine what page you are viewing.  If you would
like to override that, you can add a "" entry to your application.conf: