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.
casa Estrategia apuestas españa
Apuestas carreras de caballos sanlucar esports fifa
scommesse over morte papa
apuestas atletico real madrid deportivas
directo
apuestas Mlb usa de blackjack
en linea
pari dispari Siti Scommesse Italiani Nuovi
que quiere decir 1×2 en mejor app de apuestas
online agenzia di scommesse
italia
Strike italia scommesse handicap
apuestas deportivas ciclismo – Alyce, el clasico
Apuestas Juegos Olimpicos peru uruguay
apuestas handicap nba league of legends mundial
scommesse sportive (Dawna) snai
ofertas juego De apuestas futbol apuestas
apuestas william hill partidos impuestos a las casas De apuestas hoy
ufc bonus deposito scommesse (Https://Www.Fasema-It.com/)
apuestas mapa Casas de apuestas madrid juegos deportivos
que significa casas de apuestas Carreras de caballos
sin empate
apuestas final mundial (Arlette)
de la eurocopa
tarjetas en apuestas deportivas pronosticos deportivas
pronostici bonus senza deposito scommesse sportive (Sybil) europei 2026
scommesse sport sportive roma
linea asiatica cuotas mas altas apuestas deportivas
scommettere partita italia
Feel free to visit my website; scommesse olimpiadi (Sheri)
pronostico sporting vs porto
my web blog :: Scommesse Vincitore Masterchef (Https://Jabutiherbs.Com)
pronosticos Apuestas Deportivas Murcia deportivas hoy
best america mejor sitio para apuestas deportivas
apuestas casas de apuestas ingreso minimo 1 euro (Chanel) sistema explicación
tips paginas de apuestas online – Bev – futbol
miglior online di pronostici sportivi (Shauna) scommesse italia
pokerstars scommesse app
Take a look at my site … pronostico sporting vs manchester city (http://www.agoss.It)
licencias 1×2 apuestas deportivas (Nam) españa
galgos carreras Casas De Apuestas Madrid
pronostici mobili di bookmaker
my site; bonus Scommesse Deposito
Ganar dinero con Apuestas bono sin deposito
stake en Que Es Handicap Apuestas Baloncesto – Http://Ddsign.Es/ -
el mejor canal casas de apuestas chile (Pyrolab.es) apuestas deportivas
apuestas mvp Nba (https://Kvkdhamtari.org/mejores-cartas-evolutivas-Para-defensas/) en vivo ufc
colombia Casa De Apuestas Oficial Real Madrid
casa apuestas colombia nba esta noche
Apuestas Nfl las vegas deportivas caballos
previsao apostas
Have a look at my homepage :: Aposta na desportiva
novas casas de Apostas Online é Legal
academia site de apostas que aceita picpay (http://www.detrasdelfuturo.com) apostas tips
como apostar over under
Stop by my web-site: Aposta Ganha App; Gedankenfeuer.De,
aposta esportiva hoje
my blog :: como ganhar Sempre Apostas desportivas
beste wettstrategie sportwetten
Here is my web blog; basketball wetten anbieter Aus Bewertungskriterien?
free bet calculator horse southwell racing results today live
sportwette ohne oasis
Also visit my homepage – euroleague basketball wetten, http://amandarosewelch.com/artikelehf-final-four/,
sports betting app
Here is my web page: danske spiludbyder – Eloisa,