Grails list max results -


i have controller below returns 100+ results , want able pass 10 results json call , sort of method if more results desired request should made i'm not sure how go doing this.

here's except of controller

def list(){    def results = domain.list(max: 10)    withformat {        json (render results json)    }  } 

can point me in write direction can read on documentation or see sample codes might this.

thanks!

the default scaffolding templates place show how pagination in list action. how this:

def list(){    // max 10 unless else requested    if(!params.max) params.max=10    def results = domain.list(params)    withformat {        json (render results json)    }  } 

to request next page of results you'd use .../list?offset=10&max=10, next use offset=20, etc.

refer docs list() method on how pagination parameters work.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -