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.zamsh.com/author/lily25/
https://facesandhorizons.com/author/planihd5073/
https://facesandhorizons.com/author/planihd5073/
https://mirfali.com/author/belarususo854/
usa usd 200 no deposit bonus 200 free spins 2021,
no deposit bonus codes bets10 casino bonusu (Salina) usa and rules of
roulette uk, or casinos in windsor australia
https://mirfali.com/author/belarususo854/
http://bbs.yongrenqianyou.com/?4347924
usa online casinos new, uk no deposit casino bonus 2021 and bet365 money blackjack usa,
or bingo cash free uk
Also visit my blog post :: why do we enjoy gambling – Krista,
http://bbs.yongrenqianyou.com/?4347924
united statesn roulette builders, canadian gambling laws and canadian casinos still accepting skrill, or pay by phone bill Casino Bethlehem Pa Open australia
best online casino in new united states the pokies king,
united kingdom tax casino games craps free (Whitney)
winnings and spin palace casino canada download, or real money australian pokies online
http://bbs.xingxiancn.com/home.php?mod=space&uid=836350
https://mirfali.com/author/belarususo854/
http://bbs.xingxiancn.com/home.php?mod=space&uid=836350
https://cq.x7cq.vip/?9486622
http://thelifeofmissy.com/author/drugics44/
https://cq.x7cq.vip/?9486622
http://thelifeofmissy.com/author/drugics44/
game apps to win real money canada, canada online casino no deposit and casino games with no depoised free bonus usa
players, or sun bingo uk
Feel free to surf to my web page: who owns the biggest casinos in the world – Earl
-
http://wudao28.com/home.php?mod=space&uid=2523352
best usa online casinos that payout, 2021 no deposit bonus codes
nz and casino frenzy 250 free spins, or poker online uk free
my web-site; Blackjack Chance Of Dealer Busting
http://erolaslan.com/author/cafexbn949/
Helpful information. Lucky me I discovered your website accidentally, and I am surprised why this coincidence didn’t came about in advance! I bookmarked it.
http://wudao28.com/home.php?mod=space&uid=2523352
http://erolaslan.com/author/cafexbn949/
uk gambling triennial review, wausau wi area casinos and usa online casinos for real money, or
united statesn gambling regulations
Also visit my web-site; best casino players club (Bridgette)
https://www.worldanvil.com/author/aliciagreen
united states online casino real money, united kingdom idol time slot What Is The Difference Between Betting And Gambling arcade slot machines for
sale uk, or online canadian casino real money
https://test.elit.edu.my/author/tryingdfm4963/
http://bbs.wj10001.com/?2663939
https://ekoclean.es/author/sensorsood24/
You could definitely see your enthusiasm in the work you write.
The world hopes for more passionate writers such
as you who are not afraid to say how they believe.
Always go after your heart. xnxx
https://aliciagreen1.website3.me/
triple shot pokies united states, do you have how to earn real money online games [Noemi] pay taxes on gambling winnings in australia and live dealer blackjack canada,
or united kingdom online casino 10 minimum deposit
https://aliciagreen1.website3.me/
https://aliciagreen1.website3.me/
best casino bonus new zealand, usa casino club mobile and las
vegas usa vulkan casino Russia online
no deposit bonus codes, or best real money pokies new zealand
http://www.tabletwetestates.es/author/liabilitiesraw48/
http://www.tabletwetestates.es/author/liabilitiesraw48/
http://wargame-workshop.com/bbs/?949743
http://cruiseschoolet.com/author/worstcey35/
http://wargame-workshop.com/bbs/?949743
best online usa casinos, australia casino where and online craps australia, or best online casino app nj;
Ashli, online casino for slots uk
https://sangtac.waka.vn/author/lily-orDkae6oQz
http://cruiseschoolet.com/author/worstcey35/
http://cruiseschoolet.com/author/worstcey35/
https://sangtac.waka.vn/author/lily-orDkae6oQz
http://lucatiadesign.co.uk/author/rightsews660/
http://lucatiadesign.co.uk/author/rightsews660/
http://lucatiadesign.co.uk/author/rightsews660/