html - Make grails pagination -


my controller returns results in array this:

 render (template: 'show' , model: [changes: changes]) 

show default action , changes array created query(createcriteria). how can make pagination in index.gsp page displaying results in html div?

my problem:

controller:

def list() {         [terminhistorie: changes, terminhistoriecount: changes.size()]     } 

gsp:

<g:paginate controller="terminhistorie" action="list" total="${terminhistoriecount}"/> 

error: tag [paginate] missing required attribute [total] @ c:/users/matejb/documents/netbeansprojects/gutmann/grails-app/views/terminhistorie/index.gsp:309

the way pagination works first need create view using paginate tag, on show action need slice changes. meaning view send offset , max parameter , createcriteria query database data. take @ page , here see how can pass max , offset createcriteria method.

to see example, see page or create new application 1 simple domain , generate scaffolding it. grails generate paginated result you.

btw, if using ajax might want use remote paginate plugin.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -