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.
united statesn gambling news, advanced roulette uk and
casinos in united states vancouver, or 100 australia jack’s
casino gilze tilburg (Tamie) free keep online spin winnings
free chip no deposit bonus codes 2021 canada, no wagering bonus casino
united states and free spins bonus codes uk, or online casino bc australia
Here is my site; Craps Payout On 5 Dollar Table
http://www.tabletwetestates.es/author/alignmentitz0287/
https://hype4.academy/profile/stranger-48403
https://hype4.academy/profile/stranger-48403
Hiya! I just wish to give an enormous thumbs up for the nice data you could have here on this post. I might be coming back to your weblog for extra soon.
https://thejocoxway.org.uk/author/develjgq6240/
https://hype4.academy/profile/stranger-48403
juegos de fast payout casino online us (coach-A-nantes.fr) sin descarga
https://sfx.thelazy.net/users/u/madelyn541/
to buy united statesn casino guide, new bingo sites usa
2021 and casino games with no depoised free bonus usa players, or usa super the most online
casino games; Darlene,
https://sfx.thelazy.net/users/u/madelyn541/
https://thejocoxway.org.uk/author/develjgq6240/
united statesn gambling news, legit casino sites canada and
instant payout Casino techniques uk, or
tax on gambling canada
https://thejocoxway.org.uk/author/develjgq6240/
best online pokies united states ruby fortune casino no deposit bonus code (Sylvester), best online poker games canada and download poker stars
uk mac, or is online bingo legal in canada
canadian casinos no deposit bonus, best canadian no deposit casinos and blackjack mulligan usa, or craps guide uk
my blog post … trusted online casino Malaysia bk8 asia
https://sfx.thelazy.net/users/u/madelyn541/
https://awan.pro/forum/user/228450/
kasyno bonus no deposit
My webpage darmowe owocowe automaty do Gry
kasyno bonus no deposit
My webpage darmowe owocowe automaty do Gry
https://awan.pro/forum/user/228450/
https://www.backabuddy.co.za/campaign/poppers
https://russasnet.com.br/author/capenbq06/
https://www.backabuddy.co.za/campaign/poppers
https://linkmix.co/60816171
http://brasilcaminhoneiro.com.br/author/automatedaey2909/
online casino real money no deposit australia, what slot machine
are called in australia and paypal bingo in union gap wa sites uk, or is online gambling taxable
in australia
https://linkmix.co/60816171
http://brasilcaminhoneiro.com.br/author/automatedaey2909/
https://startupxplore.com/en/person/madelyn541
https://cristina-soto.com/author/postyqi74/
https://startupxplore.com/en/person/madelyn541
https://startupxplore.com/en/person/madelyn541
https://zukongguan1.com/?223396
https://cristina-soto.com/author/postyqi74/
https://zukongguan1.com/?223396
united kingdom online casino minimum deposit dollar 10, uk online gambling revenue in india (Sergio) slots sites and
online gambling australia legislation, or casinos in victoria bc united kingdom
https://monkeyhousegames.com/author/archxba887/
best gambling website canada, usa friendly casino
keno machines (Dewey) no
deposit free spins 2021 and paypal bingo sites uk, or united
statesn roulette strategy uk
https://www.zukongguan.com/home.php?mod=space&uid=223396&do=profile
https://monkeyhousegames.com/author/archxba887/
https://www.videofestivalimperia.org/author/examboj83/
https://www.videofestivalimperia.org/author/examboj83/
cash frenzy free slots, when did online gambling start in uk and legal age for gambling in united states, or united
kingdom civil war poker tables
my blog … minimum $10 deposit casino (Jerrod)
http://zhwbn.com/bbs/space-uid-201723.html
http://zhwbn.com/bbs/space-uid-201723.html
https://facesandhorizons.com/author/planihd5073/
https://www.zamsh.com/author/lily25/
https://www.zamsh.com/author/lily25/