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://www.cnrxw.cn/?19804
https://forum.issabel.org/u/madelyn541
https://forum.issabel.org/u/madelyn541
https://forum.issabel.org/u/madelyn541
ecopayz kasyno online (Carma) kryptowalutowe bonus
https://protocol.ooo/en/users/madelyn541
https://protocol.ooo/en/users/madelyn541
scommesse del giorno ripescaggio italia
5 zł gratis najlepsze kasyno online bielsko-biała
online
https://www.cnrxw.cn/?19804
https://protocol.ooo/en/users/madelyn541
https://chuangu.xyz/home.php?mod=space&uid=113191&do=profile&mobile=no
https://tealfeed.com/madelyn541_110586
https://chuangu.xyz/home.php?mod=space&uid=113191&do=profile&mobile=no
polskie kasyno litecoin
my blog – top 5 kasyn z bonusem
https://chuangu.xyz/home.php?mod=space&uid=113191&do=profile&mobile=no
Hey! I’m at work browsing yoyr blog frfom my new iphone!
Just wanted to sayy I love rdading through your blog and lok
forward to all your posts! Keep up thee great work! xnxx
https://tealfeed.com/madelyn541_110586
https://www.grepmed.com/madelyn541
kasyna katowice ranking 2026
Feel free to surf to my web blog – top automaty
online (https://WWW.Greenday.se)
https://www.grepmed.com/madelyn541
slot machines ontario united states, poker site usa and australia slot online,
or bingo online for money united kingdom
Feel free to surf to my blog; sneak weapons into casinos new vegas
polskie kasyno tether
My homepage – bezpłatne gry hazardowe (Carol)
automaty do gier do grania
Feel free to surf to my page – Kasyno Online W Polsce Paysafecard
https://www.grepmed.com/madelyn541
kasyno klarna 2026
my webpage … Live Ruletka Bonus
baccarat na żywo od 5 zł
My blog :: Eth casino bonus Za rejestracje
https://app.brancher.ai/user/Bzqq_ImHK-uk
https://app.brancher.ai/user/Bzqq_ImHK-uk
http://delphi.larsbo.org/user/madelyn541
https://www.blurb.fr/user/phillidaimme
https://www.blurb.fr/user/phillidaimme
poker gry na żywo na prawdziwe pieniądze (Stefanie) żywo z bonusem
https://feyenoord.supporters.nl/profiel/189646/madelyn541
mega ball live po polsku
Take a look at my homepage – kasyno z depozytem 15 euro
gry kasynowe ranking 2026
Feel free to surf to my web-site; blackjack z bonusem na start
https://feyenoord.supporters.nl/profiel/189646/madelyn541
https://freeicons.io/profile/997299
http://www.biblesupport.com/user/810088-aliciagreen/
kasyno mifinity 2026 (https://blog.zetechnobreak.com.br/)
online bez dokumentów
http://www.biblesupport.com/user/810088-aliciagreen/
http://asresin.cn/home.php?mod=space&uid=624595
https://www.designspiration.com/madelyn541/saves/
live poker 5 zł bonus za rejestrację kasyno online online
https://www.designspiration.com/madelyn541/saves/
http://asresin.cn/home.php?mod=space&uid=624595
https://www.designspiration.com/madelyn541/saves/
how to hack slot machines uk, united statesn poker and
largest casino in australia 2021, or real money australian pokies online
Stop by my homepage :: craps table odds chart
http://asresin.cn/home.php?mod=space&uid=624595
https://apptuts.bio/apricotrural-257329