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.
livespil sport
my webpage: oddsudbyder med Free bet
wedden met bonus
My web-site :: betrouwbaar casino site nederland zonder cruks – Jon,
betting med skrill
Also visit my blog post; sammenlign spiludbydere (Brook)
odds dart i dag
Here is my homepage betting app ios
metal ligaen odds
Here is my website: bedste udenlandske bettingselskaber
Thanks for your write-up. I also feel that laptop computers have gotten more and more popular currently, and now in many cases are the only type of computer used in a household. The reason being at the same time they are becoming more and more affordable, their processing power is growing to the point where they’re as highly effective as personal computers out of just a few years back.
klassische spielautomaten online
Here is my blog megaways slots hohe gewinne (Colette)
online casino anmeldelser
Also visit my blog; bedste spilleautomater
(Therese)
élő fogadás külföldi lista
My website – legális fogadó oldalak (Cindi)
horse hove greyhound racing live Stream bet strategy
online casino jetzt spielen (Alfonzo)
mit 5 euro einzahlung paysafecard
horse racing betting apps uk
Feel free to visit my web-site; Windsor Races Betting
slotspiele um echtgeld
Feel free to surf to my site … slots kreditkarte auszahlung
automaty 3d kasyno apple pay szybka wypłata (Milagros) online
windsor Greyhound racing Betting today results and payouts
pelipiste turku
Take a look at my web-site … Parhaat Dart Kertoimet
best payout online slots canada, skrill united states gambling and poker tour australia, or registration bonus madera casino (Sherrill)
usa
Slots Dansk casino casino gratis spins
united kingdom online casino real money no deposit bonus, online
slots casino australia and uk online gambling news,
or slot machine sales uk
Have a look at my website :: casinos that pay same day
how do poker machines work in australia, no deposit
online casino united states and top 100 usa casino sites, or united kingdom poker machine
game download
My web site: Nsw Gambling
online slots 96 procent rtp
Here is my website: dansk Blackjack app casino
horse race betting odds calculator
Also visit my web-site :: Ascot racing betting
automaty do gry nowe przepisy
Also visit my web-site :: aplikacja kasyna wszystkie sloty
is betting on How To Calculate Place Bet Payout Horse Racing racing legal
free bets grand national
Here is my blog post: is greyhound racing Legal uk
bet365 roulette strategy usa, real slot machines for sale canada and 500 poker chips united kingdom, or best australia pokies
Check out my blog – gambling sites that accept american express, Vilma,
continyously i usrd too read smasller artkcles tnat aloso clear their motive,
andd thwt iss also happenig wigh thbis paragraph whic I amm readng now.
xnxx
lista kasyn z wysokim rtp
Also visit my web site; Kasyna Online lublin
vedonlyönti visa
My blog post … mestarien Liiga vihjeet tänään
online casinos in ontario australia, best slots online canada and directions real gambling games to win real money, Roma,
potawatomi casino in milwaukee, or casino age limit
canada
how to bet on what are good odds in betting
horse racing (Ada)
racing online
online casino auszahlung über paysafecard
Also visit my web site – 100 freispiele ohne einzahlung sofort
best horse racing betting sites uk dog racing results Today
Udenlandske Casino Med BankoverføRsel 2026 velkomstbonus
1 euro
online gambling laws in uk, top uk online casinos and
cash freuky casino free how to play blackjack with chips, or gambling in ontario united states
doppel null roulette gewinn
Also visit my blog post … Online Slots Ab 20 Cent Einsatz
free pokies canada aristocrat, free spins sign up casino australia and fishing frenzy slot free online, or
play online pokies usa
Feel free to surf to my page … casinos in ruidoso open – Van -
ingyenes sportfogadási tippek
Have a look at my page; mit jelent a rendszerfogadás (Hugh)
free horse racing bets no deposit
Look at my webpage dog track betting (http://kmn.pfz.mybluehost.me/website_7b221ead/betting-strategies-for-high-risk-high-reward-bets/)
vedonlyönti app android
Look into my web site :: Koripallo Vihjeet
the blackjacks homepage canada, is there a casino in taunton and new us gambling, Sima, sites australia, or
$1 deposit casino usa 2021
trusted online pokies australia, real online money casino canada and bingo bonus usa welcome, or win real money online free usa
Here is my page: blackjack Mw5
results for wolverhampton races
Feel free to visit my website :: best bet dog racing (Elisabeth)
united kingdom poker 90 s, canadian pokie machines for sale
and largest casino in australia 2021, or awesome online Treasure chest casino moving
new zealand
bet united states online casino bonus, canadian slots free play and casino listings usa,
or casino united states age
My webpage: why are they called pokie machines
today’s horse racing results from newcastle
Here is my homepage – Greyhound fast result
value fogadás mit jelent
Also visit my webpage; SportfogadáS Paypal
horse racing betting strategies Free Bets on grand national
the great united statesn casino everett, online casino australia reddit and free $100 casino chip 2021 usa,
or uk gambling forum
Also visit my website … Apps That Pay You Real Money In Nigeria
blackjack seriöses casino Auszahlung auf konto, http://www.katkinsonphotos.com/blog/sicheres-casino-roulette-echtes-geld-mit-Einzahlung/, visa