Question

Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?

Was it helpful?

Solution

You have to install scaffold templates with:

grails install-templates

Now, edit in src/templates/scaffolding Controller.groovy and increase the value params.max as you want

OTHER TIPS

I found this but can't get it to work. You're supposed to be able (according to this) to scaffold and then override the actions you want (say list) in your controller, but like I said, it doesn't work for me...

class PersonController {
  def scaffold = true

  def list = {
    if(!params.max) params.max = 20
    [ personList: Person.list( params ) ]
  }
}

Ok, if you use dynamic scaffolding a workaround for this bug, is edit directly in your GRAILS_HOME/src/grails/templates/scaffolding

Add to the uri:

?max=<num_rows_desired>

For instance:

http://projecthost:8080/Library/Books/list?max=20
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top