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.videofestivalimperia.org/author/roseowe56/
https://www.videofestivalimperia.org/author/roseowe56/
https://modernhomemakers.com/author/returninglqc12/
https://modernhomemakers.com/author/returninglqc12/
https://modernhomemakers.com/author/returninglqc12/
https://www.vid419.com/?3478658
https://www.vid419.com/?3478658
https://www.vid419.com/?3478658
http://brasilcaminhoneiro.com.br/author/dosiqr1303/
https://uvirtual.edu.co/author/textamg4867/
https://uvirtual.edu.co/author/textamg4867/
http://brasilcaminhoneiro.com.br/author/dosiqr1303/
http://www.grecal.net/author/brilliantrud711/
888 poker deposit united kingdom, bingo online play
usa and canada online German Casino online slots, or win real money online free usa
https://treo.sh/sitespeed/poppersnow.ru
http://www.grecal.net/author/brilliantrud711/
https://thepropertybull.com/agent/lily-long/
bet365 money casino usa, no deposit required online casino
usa and no deposit cash bonus how to play let it ride at the casino (Michell)
canada, or free poker machines online united states
https://thepropertybull.com/agent/lily-long/
https://uvirtual.edu.co/author/internationallyxwx665/
http://brandconti.com/author/ghanardx513/
best poker app usa, slot machine bases canada and new zealandn gambling habits, or free
online casino based in australia (Ricky) money united states
https://sfx.thelazy.net/users/u/aliciagreen/
http://brandconti.com/author/ghanardx513/
http://brandconti.com/author/ghanardx513/
http://beer4billy.com/author/uppervzl0532/
kasyno za 10 centów
Here is my web-site: Jakie są najlepsze kasyna online
http://beer4billy.com/author/uppervzl0532/
https://thefrigidfrog.com/author/shotuay01/
https://thefrigidfrog.com/author/shotuay01/
bingo kasyno online z licencją – Monique, online polska
https://thefrigidfrog.com/author/shotuay01/
250 zł za rejestrację 2026 Kasyno online (https://Www.Dlnihair.com) z
maszynami slotowymi
united statesn roulette online fast, casino winnings tax free in canada and good morning
united states time slot, or united statesn gambling regulations
Review my web site: baccarat cyber monday code
big usa poker tournaments, casino jack milwaukee and canada online gambling
laws, or win real money online casino Bingo for Pc free usa
http://beer4billy.com/author/uppervzl0532/
http://nursesoncall.com/author/contributorrkf27/
http://nursesoncall.com/author/contributorrkf27/
https://squacre.com/author/lily25/
https://squacre.com/author/lily25/
Kasyno karta prepaid Darmowe spiny dogecoin 2026
gry darmowe Obroty w Grach kasynowych automaty online
http://www.sputres.ru/forum/home.php?mod=space&uid=432743&do=profile&from=space
gry w blackjacka 21
My site; Baccarat Gra online
http://www.sputres.ru/forum/home.php?mod=space&uid=432743&do=profile&from=space
https://www.sosyalciniz.net/author/teachvij785/
https://siteassurance.com/domain/poppersnow.ru
slots no wagering uk, roulette ai automatic and
free Bingo number generator free download games
united states, or poker sites australia 2021
https://siteassurance.com/domain/poppersnow.ru
https://siteassurance.com/domain/poppersnow.ru