grails - Customizing g:paginate to Prepend "Page x of y" -


i have simple scenario i'm using g:paginate pagination, next need "page x of y" next actual pages. example, if i'm on page 3 out of 10 pages total, want have (obviously pages other 3 links):

page 3 of 10 << 1 2 3 4 .. 10 >> 

there doesn't appear way out of box, , i'm wondering if has ever come across or can think of way pull information out of tag, if made custom taglib pulled appropriate properties out of g:paginate (just idea), or other solution okay too.

assuming you're providing view total count, , assigning params max , offset value in controller, think have need calculations "x of total" message.

basically snippet generate "x of toal" is:

page ${((params.offset long) / (params.max long)) + 1} of ${instancetotal} 

you assign prev attribute in paginate tag, unfortunately prev not show when you're on first page. think you're best either extend functionality in custom tag, or use snippet above outside of paginate tag.


Comments