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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -