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.
roulette legales casino ohne autoplay sperre (Toby) schnelle auszahlung
comparador de villarreal liverpool apuestas (Lavada)
casas de apuestas bonos sin deposito futbol mundial
blackjack 21+3 regel
Here is my blog; Casino Richtig Spielen [Http://Apack.Lionsmedia.Agency/]
handicap baloncesto mejores casas apuestas Tenis
gratta e vinci online gratis senza registrazione
Look into my homepage baccarat Sito Ufficiale (http://www.centrailsogno.org)
beste online casino 300 prozent bonus (http://www.aslan-kurban-adak.com) casino deutschland
erfahrungen
blackjack mit geld spielen
My website; beste rogue slot
online slots mit giropay
casino echtgeld geschenkt
romme online casino ab 100 euro klarna (Loretta) spielen
app spielautomat
Here is my web page roulette bis 1 euro einsatz
20 ilmaiskierrosta rekisteröitymällä kasino
Check out my web page; paras Nettikasinot live
hoja de calculo apuestas betplay hoy colombia (Woodrow) deportivas
online casino 10 euro einzahlen 200 freispiele, Danuta,
auszahlungslimit
online casino wo man mit paypal zahlen kann, https://bielefelder-freimaurerinnen.De/,
ohne verifizierung mit paysafecard
partidos amañados Impuestos Apuestas Online
slovenské online stávkové kancelárie
Here is my site … čo znamená tip 0
online casino 30 euro neosurf
Feel free to surf to my website: roulette spiel hochwertig
(Darrin)
Apuestas ascenso a segunda partidos champions league
pronostico apuestas de futbol (https://www.qualitycontrol.Es)
athletic betis
cashback slots casino Uden licens med gratis spins
Excellent post. I was checking constantly this weblog and I’m impressed!
Very helpful information specially the final section
I maintain such information a lot.
I used to be looking for this certain information for a long time.
Thanks and good luck.
Feel free to surf to my web page; birthday no deposit casino bonuses
top casino ohne 5 sekunden
Feel free to visit my webpage :: Welche slots sind die besten
online casino winners usa, usa roulette rules and casino
online real money canada, or are casinos legal
in australia
Check out my web blog … blackjack 26
keno online echtgeld
Also visit my web blog – Blackjack Ab 1 Euro Einsatz
uudet kasinot 200
Here is my web-site: nettikasinot jackpot (https://kyolo.com)
predicciones apuestas deportivas bono sin deposito futbol
hoy
roulette null setzen gewinn
Also visit my blog – virtuelles casino 25€ bonus ohne einzahlung
One thing I’d like to say is that often before buying more computer system memory, look at the machine within which it will be installed. When the machine is definitely running Windows XP, for instance, the memory limit is 3.25GB. The installation of above this would basically constitute some sort of waste. Make sure that one’s mother board can handle an upgrade amount, as well. Thanks for your blog post.
roulette multiplikator zahl
my site – casino maximale einzahlung
roulette am spielautomat
Feel free to visit my web-site casino ohne mindesteinzahlung kreditkarte (http://www.noonanandcompany.com)
megaways spielautomaten freispiele
My site – bally casino liste
legaal casino site belgie met cashback
My web site :: Beste Irish Slots (Dsnarquitecto.Es)
comparativa casas Apuestas (http://Www.elateliercreaciondeespacios.Es) combinadas pronosticos
Online Casino Ab 25 Euro Flexepin
bonus mit handyguthaben einzahlung
nueva ley mejores apuestas combinadas Para hoy
buscador de apuestas en Linea peru (https://www.grupmecal.es/las-casillas-de-apuestas-mas-Atractivas-analisis-comparativo/) seguras
handicap asiatico en combinadas apuestas deportivas
uusin nettikasinot
my site – brite kasino talletus raja
casino sin depósito 100 (Chandra) en las grutas
bezpłatne gry hazardowe
my web site: Kasyno litecoin 2026
Betting App With Live Streaming shop cardiff
app para pagina apuestas gratis (http://nueva.falconbs.Es/2026/08/05/como-funcionan-Las-resenas-de-Casas-de-apuestas-virtuales/) deportivas
nové tipovacie stránky
My blog post: etipos prihlásenie (http://ridel-kougoum.com/)
apuestas egipto uruguay cuotas altas
online casino highroller
My web blog; spielautomaten spiele mit freispielen (lindinger-schmid.de)
caesars slots juego de Casino Mobile españa
gioco d’azzardo su pronostico
Here is my website; in quanti si gioca a burraco
apuestas en nba (Mavis) con paypal
besten online spiele
My homepage casino mit 50 euro einzahlung paypal