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.
automaten online spielen echtgeld
Feel free to surf to my blog post; neue casinos mit curacao lizenz
schnellste spielautomaten online
ipad
https://divisionmidway.org/jobs/author/lily25/
kasyno Od 50 zł darmowe spiny (8660haarbyvand.dk) blik
wpłata od 50 zł
https://pixelandbloom.com/author/jacksonvilletag6294/
online casino mit paysafe card einzahlen casino kostenlos echtgeld
totoguida giochi scommesse online (Jeff)
legalne kasyno z blik
My web page gry automaty w polsce
https://pixelandbloom.com/author/jacksonvilletag6294/
I’d like to find outt more? I’d want tto find out more details.xnxx
https://divisionmidway.org/jobs/author/lily25/
https://divisionmidway.org/jobs/author/lily25/
https://pixelandbloom.com/author/jacksonvilletag6294/
beste gewinnchance spielothek
Visit my web-site – Online Bingo Um Geld
bestes iphone blackjack
Also visit my blog – rubbellose Um echtgeld
online casino roulette ohne einsatz drehen; Earle, casino mit instant win spiele
https://buildingchurch.tv/author/assignmentlds635/
https://buildingchurch.tv/author/assignmentlds635/
migliori bonus benvenuto scommesse italia poker
blackjack online kasyno od 20 zł z darmowymi spinami 25 zł
https://buildingchurch.tv/author/assignmentlds635/
sicheres casino App mit geld ohne 5 sekunden
kasyno 25 zł depozyt bonus
Also visit my blog – baccarat online 2026
najlepsze kasyna kraków
my web-site; bezpieczne kasyno online kasa na start
rabona Scommesse app passaggio turno coppa italia
lightning dice ranking
Also visit my web-site 150 zł bonus bez depozytu 2026 kasyno online (Jesse)
https://gitlab.haskell.org/madelyn541
https://gitlab.haskell.org/madelyn541
https://devpost.com/aliciagreen
pronostici vincenti scommesse sportive su siti non autorizzati aams
https://devpost.com/aliciagreen
https://devpost.com/aliciagreen
https://gitlab.haskell.org/madelyn541
https://forum.aigato.vn/user/madelyn541
kasyno 15 euro na start [https://galicya.gastroopinie.pl] polską
777
https://forum.aigato.vn/user/madelyn541
https://destaquebrasil.com/saopaulo/author/lily25/
darmowe sloty za rejestracje
Also visit my web-site – Automaty owocowe od 10 groszy (cucinanuova.Com)
https://destaquebrasil.com/saopaulo/author/lily25/
https://forum.aigato.vn/user/madelyn541
polski live ruletka
Also visit my site WypłAcalne Kasyna 2026
https://www.codingame.com/profile/583f8403590c7e160f5647184cec16c60893567
https://www.criminalelement.com/members/aliciagreen/profile/
https://www.codingame.com/profile/583f8403590c7e160f5647184cec16c60893567
https://www.criminalelement.com/members/aliciagreen/profile/
https://www.criminalelement.com/members/aliciagreen/profile/
125% bonus 1000 zł bez depozytu za rejestrację kasyno online depozyt kasyno
https://www.codingame.com/profile/583f8403590c7e160f5647184cec16c60893567
gry online kasyno pl
my blog: top 5 kasyn wypłacalnych
It’s goinmg to be ending off mine day, howewver befre fonish I am reading this
fantastic paragrraph to increase myy knowledge. xnxx