I couldn’t find a good set of macros to help navigate through paginated data so I wrote my own. The macro names echo the names of the CakePHP PaginationHelper functions because…well, they’re reasonably sensible.
The macros expect you to add a model attribute called “paginationData” which contains (at least) the following properties:
pageNumber -> The current page number
pageSize -> The number of items in each page
pagesAvailable -> The total number of pages
sortDirection -> The sorting direction (ascending or descending)
sortField -> The field currently sorted by
In my implementation, my paginationData also contains a property called “pageItems” – the actual items in this page.
The macros available to you are:
- first
Outputs a link to the first page - last
Outputs a link to the last page - next
Outputs a link to the next page - previous
Outputs a link to the previous page - numbers
Outputs links to other pages. The macro takes a parameter called “maxPages”, which is the maximum number of pages that should be output. There is also a second parameter “separator”, which is the text/html that should be output between each page link. - page
Outputs a link to a particular page. It takes the page number and link text as parameters. If you omit the link text it’ll default to the page number - counter
Outputs the current page number and the total pages e.g. “1 of 20″ - sort
Outputs a link to sort by a field. Takes the field to sort by as its first parameter. If field is different to the current sort field, the link will change the sort field but not the sort direction. If the field is the same as the current sort field, the link will change the sort direction. The second parameter is the link text, which defaults to the field name with an upper case first letter. It also takes a parameter called “directions”. This is an an array of two items: the words being used in paginationData.sortDirection to describe the sorting direction of ascending or descending. Default: ["Asc", "Desc"]. So it can compare the current sorting direction and switch to the converse.
Note, ordinarily you’ll probably not need to use the “page” macro.
How to use
In Java, add a model attribute “paginationData” containing the properties I’ve described above. Then, in your view, import the library:
<#import "pagination.ftl" as pagination />
Call the macros:
<nav style="float:right;">
<@pagination.first />
<@pagination.previous />
<@pagination.numbers />
<@pagination.next />
<@pagination.last />
</nav>
<@pagination.counter />
Which’ll give you something like:
![]()
For table headings that allow sorting:
<table>
<tr>
<th><@pagination.sort "forename" /></th>
<th><@pagination.sort "surname" /></th>
<th><@pagination.sort "email" /></th>
<th><@pagination.sort "created" "Registration date" /></th>
</tr>
...
</table>
Download
You can download the pagination macros here.
https://espartinas.org/info/?mode=profile&user=580848
https://lospromotores.net/author/jpgrsw00/
btts Scommesse ripescaggio Italia
casino ohne 5 sekunden lastschrift
My web site; Keno Quoten
https://lospromotores.net/author/jpgrsw00/
sloty z bonusem na start
my page kasyno lublin paysafecard, Stuart,
vstart scommesse
Here is my blog post :: bookmaker belgio italia (Florrie)
chi pronostici Scommesse Bologna
sportive
7 zł bez depozytu za rejestrację kasyno online online zielona góra
online casino mit echtgeld bonus casino ab 10 euro paypal
https://espartinas.org/info/?mode=profile&user=580848
the top online pokies and casinos in united states 60fps, united states
online casino real money and free bonus no deposit uk slots,
or bingo uk online
Feel free to surf to my webpage judgment high
rate blackjack – Lucia,
https://autism-toolkit.ie/author/unsubscribeokj859/
kombiwette spiel abgesagt
My site :: Wetten basketball Bbl
https://ekoclean.es/author/slovakiaisg36/
https://autism-toolkit.ie/author/unsubscribeokj859/
scommesse mondiali rugby (https://mywebapp.Co.in) elezione papa
united statesn style roulette, free $25 online bingo canada and most popular casino games usa, or neteller casinos uk
Also visit my website – craps dice stick for sale
sportwetten unentschieden strategie
Review my blog college Basketball Wetten
online slots kreditkarte bezahlen
Also visit my web page … besten Casinos mit trustly
https://geraldfries.de/author/logbrz55/
https://geraldfries.de/author/logbrz55/
https://ekoclean.es/author/slovakiaisg36/
famous united statesn poker, money poker online usa and las vegas usa
free blackjack casino games multi hands (Anita) online no deposit bonus
codes, or dragon link online pokies canada
https://geraldfries.de/author/logbrz55/
casino ohne einzahlung geld gewinnen
My web site; die spielbank no Deposit bonus
casino bonus mit handyguthaben einzahlung
Look into my blog post: Ungerade zahl beim roulette
https://doselect.com/@79ae838ec2302a8711c590c66
sofort casino kod promocyjny
my web-site: bonusy w kasynie bez depozytów (Jamison)
pronostici nuovi scommesse italia schedina
http://hurricanesurf.net/author/joininggjs39/
https://doselect.com/@79ae838ec2302a8711c590c66
http://pipeband.org.nz/author/modeptq6576/
scommesse Gf ippiche
http://pipeband.org.nz/author/modeptq6576/
Siti Scommesse Satispay amici
neue klassische spielautomaten
Also visit my webpage … casino ohne 5 sekunden litecoin
http://pipeband.org.nz/author/modeptq6576/
online casino mastercard ab 2 Euro mehr einsatz
kasyno online bonus gratis
bitcoin wpłata od 5 zł
best casino bonuses 2021 usa, no deposit bonus codes casino usa and pokie machines in united states, or canadian online casinos pokies
Feel free to surf to my homepage :: seacoast bingo (Lupita)
http://forum.djwx.com/?51624
http://tshirtla.com/author/additionjro8023/
kenozahlen aktuelle
Also visit my page online roulette paypal bezahlen (http://martin-cygon.de)
siti scommesse online app (https://twogethermarriageretreat.com/scommesse-vittoria-europei) fortnite
http://forum.djwx.com/?51624
http://tshirtla.com/author/additionjro8023/
live casino Niedriger einsatz 1 euro
apple pay
casino echtgeld bonus code Roulette ohne deutsche Regulierung einzahlung
http://tshirtla.com/author/additionjro8023/