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://cjtvchannel.com/author/assumedlam22/
casino sin minimo de deposito en illescas
mobile slots no deposit bonus usa, united states online casino
slots and 100 no deposit bonus codes 2021 canada, or best max money on casino heist (Bridgette) sign up offers uk
https://cjtvchannel.com/author/assumedlam22/
kasyno online katowice
Also visit my website: urząd celny gry hazardowe
casinos en andalucia
Review my web page; casino online con retiro instantaneo
bonus powitalny bezpieczne kasyno online z high roller bonusem (http://Muzeumbojkow.pl/) paypal
https://www.ruhrpott-poker.de/author/contributorsboi13/
kasyno Kraków Blik z odyssey
https://www.ruhrpott-poker.de/author/contributorsboi13/
darmowe kody do kasyn
Here is my homepage :: automaty online xrp (Garfield)
prowadzenie gier hazardowych
Also visit my webpage; maszyny hazardowe z bonusem
tragaperrasgratis con bonus casino Casinos Online Con Licencia
https://www.ruhrpott-poker.de/author/contributorsboi13/
kasyna online małopolskie
Here is my web blog; porównanie kasyn z turniejami
Jackpot Casino Online Juego (Foroturismoaccesible.Es) virtual españa tres arroyos
juegos de Casino Online Mas Seguro gratis tragamonedas clasicas
jugar juego Codigo Bono Casino Gran Madrid (Http://Www.Promaximaging.Com/) gratis
tragamonedas mas nuevas
bonos gratis para jugar casino
Look into my website: listado casinos legales españa – Lorie -
bingos con bonos gratis sin depósito nuevo casino en vigo
online
10 giros gratis no cadastro juegos de casino para pc offline; https://Gashogarciudadreal.es/,
http://riotstories.co.uk/author/lily25/
konkurs gier hazardowych
Here is my blog: 1000 darmowych spinów bonus kasyno online
https://restosales.net/agent/lily-long/
https://restosales.net/agent/lily-long/
https://restosales.net/agent/lily-long/
casino vivant españa
Here is my homepage: casinos online con bonos de bienvenida
systemy zmienne keno
Feel free to surf to my web-site … Kasyno All Slots
casinos con deposito minimo
Feel free to surf to my blog post: peso 8888 casino login, Junior,
kasyno z depozytem jeton
Also visit my web site: Lightning Ruletka Bonus Bez Depozytu (http://Www.Grandresidencephuket.Com)
mejores tragamonedas de juego que hagan ganar dinero real casino online
new zealandn poker 2 free game, bingo google; Refugio, canada login and
what poker sites are legal in australia, or canadian casino
guide 2021 review
juegos de fichas casino mallorca (Dormirencantabria.es) baccarat
zdrapki kasyno online
Also visit my site – top 20 kasyn z niskim depozytem
(Willis)
kasyna przyjmujące revolut
my webpage :: blackjack na żywo online polska – Alliancedmenetworks.com,
kasyno gra z ruletką
Here is my web site :: top 3 slotów online (Jayme)
casinos españoles con bono sin deposito
Feel free to surf to my webpage :: casino online de confianza
blackjack na telefon ranking
Also visit my website – Kasyno Bez WkłAdu WłAsnego
https://radrounds.com/author/lily25/
juegos de casinos gratis sin descargar maquinas nuevas
Take a look at my homepage: Jugador casino en linea
https://radrounds.com/author/lily25/
mobilny blackjack mobilne Kasyno online najlepsze
https://www.r-users.com/author/lily25/
https://www.r-users.com/author/lily25/
kasyno zarabiaj pieniądze online w kasynie (https://Skg.Swn.pl/) z automatami
casino santa pola
my web page Maquinas Para Casinos En EspañA
todo sobre el jugar al casino sin deposito
quiero juegos de casino reales gratis (http://Www.ludi-star.com) de casinos
https://projekt-office.ch/?URL=poppersnow.ru
new zealandn online casino 5 dollar min deposit, united statesn online poker machines and australian prime minister blackjack, or uk vietnamese
gambling card game (Hung) forum