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.
live betrouwbaar casino utrecht app nederland
aposta ganha apk download
my blog post … apostas de valor fixa
casadeapostas novas casas de apostas com bônus (Georgia) app
giochi senza download – https://Www.Traslochiferrareis.it/, slot sicuri
come sapere se una slot machine paga
My webpage – martingale strategy roulette (Markus)
app android apostas
My homepage; O Que Significa Aposta Multipla
regole roulette europea
Feel free to visit my homepage candy crush gratis online (Monte)
Whatgs upp arre uing Wordepress for youjr site platform?
I’m new tto the bpog wotld buut I’m tryimg too geet started and creeate myy own. Do yyou needd anny codiing knowledge to mak yolur
owwn blog? Any hellp wold bee greatlyy appreciated!
xnxx
casinò venezia online
Here is my web-site tressette a quattro
minimale inzet nederlandse bitcoin casino ervaringen – Andrew,
apostar em xadrez
Have a look at my site – casas Das Apostas apk
tabella roulette
My website :: giocare d’azzardo Modo di dire
Investimento Em Apostas Desportivas online caixa
sistema d’alembert roulette
my homepage casinò non aams (Https://Urshort.Com/)
trevo sports aposta Jogos De hj
gioco del bridge online gratis
Here is my web page; nuove Slot 2026
livespil sport
Here is my web page – store Oddsselskaber
casas de Melhores Apostas Hoje limite app
roulette popolare
Also visit my blog … giochi senza installazione;
Rickey,
lei Consultoria Apostas Esportivas esportivas
prognóstico quero apostar
Here is my web-site: Over em apostas
bridge gioco gratis
Stop by my web page … casino che accettano discover
percentuali slot machine
Stop by my website: divisione premi tombola
esporte total melhor mercado de apostas esportivas, https://metodoinfaliveldoano.shop,
sælg spiltips
Also visit my web-site; odds med skrill
online gokken limiet
Take a look at my webpage – beste goksite makkelijke registratie
bukmacherskie na duze kursy
My blog – liga narodów siatkarzy tabela wyniki
spiltips
Also visit my website … hvad er odds
sistema martingale collares
my web page – siti slot italia – Shawna,
soldi spesi gioco d’azzardo
Check out my web blog casinò Montecarlo (https://accesscommunityasoibs.com)
hotroulette
Review my blog: roulette senza scaricar (Raul)
come si gioca punto banco
My web blog :: app Gioco d’azzardo gratis
sikre bettingselskaber
Take a look at my blog; bedste danske oddssider (Fausto)
forum abc esportiva apostas (http://inncount.com.br/2026/08/02/apostas-Em-ligas-menores-oportunidades-e-desafios/) desportivas
fortnite live odds
my homepage: oddstips i weekenden (Mervin)
casas investimento em apostas desportivas online
betting uden registrering
Also visit my homepage … oddset i dag
mma kamp forudsigelser
Here is my site – odds på Fodbold (tttf.foundation)
calculadora é Casas De Apostas Com Bonus simples
o que odds apostas online
Also visit my webpage apostar Bellator
planilha registo apostas analises
vinder odds em fodbold i dag
my blog … danske spil taastrup åbningstider; Mathew,
bookmaker med trustly danmark
Stop by my page – v75 tips (chemin-Des-7-chakras.mg)
legaal casino blackjack storten met litecoin (efinish.net) gratis spins
apostas esportivas lucro
Check out my webpage – apostar contra empate
betsafe bukmacher w polsce na kryptowaluty
beste blackjack casino trustly (Jessie)
korting nederland
egyptian slots casino
Here is my homepage alle goksites nederland (Floyd)
mercados de apostas (http://www.performancebikefit.ie/o-que-sao-apostas-em-linha-e-como-funcionam/) esportivas melhores
speelhal rijswijk
Here is my blog post beste casino Voor high rollers