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.
kasyno 150 euro na start
Check out my web page – rekomendowane kasyn z jackpotem (Https://mihalic.com)
baccarat online 25 zł na start kasyno pieniądze
https://www.sosyalciniz.net/author/teachvij785/
kasyno minimalna wpłata cashlib [Kasha] wpłata 3 zł
bonus
kasyno depozyt 40 Zł na żywo od 1 zł
http://sfgshz.com/home.php?mod=space&uid=437536&do=profile&from=space
casinos españoles online sin deposito – Addie – en castellon de la plana
http://sfgshz.com/home.php?mod=space&uid=437536&do=profile&from=space
casinos que dan dinero gratis sin deposito
Also visit my webpage :: casino virtual españa tres arroyos
https://www.sosyalciniz.net/author/teachvij785/
top 5 kasyn z jackpotem
my web blog nowe kasyno online wypłata Blik (http://Boccone.gastroopinie.pl/nowoczesne-sloty-bez-rejestracji-do-gry/)
caesars slots cual es el mejor Juego de casino online para ganar dinero
de casino
casinos online juego seguro (Travis) legales online
nowe kasyno karta prepaid kasyno od 30 zł
juegos de casino mas Nuevos; Realcurehomeopathy.Com, quinta orozco
najlepsze kasyno bonus 100% (Jan)
kasynowy w sobotę
https://sexcamgirl.org/author/lily25/
https://medibulletin.com/author/perceptionhul515/
ruletki bez depozytu
Stop by my web site … darmowe spiny po rejestracji w kasynie – Christian
-
https://sexcamgirl.org/author/lily25/
ranking kasyn kasyno online z turniejami – Stanton,
turniejami
https://medibulletin.com/author/perceptionhul515/
https://medibulletin.com/author/perceptionhul515/
https://sexcamgirl.org/author/lily25/
gry show na żywo na pieniądze
Feel free to surf to my website Kasyno Apk polskie
http://bbs.sdhuifa.com/?1081968
https://thejocoxway.org.uk/author/regulationsnp8517/
juegos de casino para ganar dinero real sin invertir en españa (https://www.gabaldo.com/spielautomaten-online-geschenkt-in-osterreich-2026/)
24 horas
casino gratis para celular [Sunjulio.com] blackjack en españa
lightning ruletka online do losowania polska
https://thejocoxway.org.uk/author/regulationsnp8517/
You made some first rate factors there. I appeared on the web for the difficulty and located most people will go along with with your website.
http://bbs.sdhuifa.com/?1081968
bingo gra online darmowa
Here is my site: Kasyno 1000 free spinów na start
no wager no deposit bonus united states, can you dispute online gambling charges (Lawrence) slot casino usa and bet uk casino, or canadian online gambling
descargar juegos de casinos para android
Feel free to visit my web-site :: casino curacao online [Olga]
http://www.rainmaker.in.th/author/depotozc666/
casino en castro
My web blog; casinos online paypal
tragaperrasgratis con bonus sin descargar ganar ruleta casino online – Wade, online
gry kasynowe kasyno Online darmowe spiny wrocław;
https://advancedroofingsupplies.co.uk/, 2026
casinos online descargar Gratis
bonos bienvenida gratis sin deposito
gra bingo na pieniądze
my web page; kasyno od 4 zł darmowe spiny (https://Landofsilence.org/)
best new casino sites usa, yukon gold casino news and best online
casino usa 2021, or are poker machines legal in western canada
Look at my blog post :: how to overcome Gambling disorder
top 20 kasyn blik
Feel free to visit my blog: gry kasynowe slotowe
- Piper -
http://www.rainmaker.in.th/author/depotozc666/
canadian poker machine game download, usa casino coupon no deposit bonuses and 100 no deposit bonus codes 2021 canada,
or tips for pokies australia
http://www.sdcssd.com/?69089
jugar por Internet casino villalba del alcor
https://samequizy.pl/author/lily25/
https://cjtvchannel.com/author/assumedlam22/