Grails Pagination Tag

Posted By : Deepak Gupta | 29-May-2015

Grails Pagination Tag

Hi All

Grails provides us many plugins to tackle problems in development. Today I'm going to tell one of its plugins called grailsPaginationTag. This plugin is used to handle pagination for list that you render on the web page.

For this plugins Just add one line in the config.groovy file .

compile ":remote-pagination:0.4.8"

Remote pagination plugins provides us tage for pagination using ajax without page loading. It provides us many tag for pagination for list of object you needed.

For Example:

public class Person{
       String name
       long id
       }
 

On controller

public class PersonController{
       
       def list{
       [list:Person.list()]
       }
       
       def filterPersonList{
       render('listTemplate',model:[count:Person.list().size(),list:Person.list()])
       }
       }
 

Now on your _listTemplate gsp

 <util:remotePagination action='filter' controller='person' total='count' update='listTemplateDiv' max='10' params=['id':1]  maxsteps='8'>

Action: name of the link to be used in the pagination

Total: size of the list

update : id of the div/span which contain the template

max: fetch max list

params:pass your own params

maxsteps: The number of step displayed for the pagination

 

Thanks

      

 

About Author

Author Image
Deepak Gupta

Deepak is a bright Groovy and Grails developer

Request for Proposal

Name is required

Comment is required

Sending message..