Giter Club home page Giter Club logo

play--paginate's Introduction

*Play--Paginate*

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
and
#{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);
render(entities);

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);
render(entities);

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");
render(entities);

*Customization*
 
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 "paginator.parameter.name" entry to your application.conf:

paginator.parameter.name=__pagenumber

play--paginate's People

Contributors

lmcalpin avatar marcosnc avatar nicogiard avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.