tags:

views:

274

answers:

3

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?

+1  A: 

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 ) ]
  }
}
codeLes
This is the correct way to do it.
Bill James
+2  A: 

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

dahernan
That was my first suggestion, but if you try it you'll see that it only works if you then use the command: grails generate-* commands, so I removed it. There is an issue open and I think they may include that in 1.1, I'm hoping anyway: http://jira.codehaus.org/browse/GRAILS-2749
codeLes
+1  A: 

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

dahernan