Thursday, June 27, 2013

How to order field by using scaffold ?



Here is the official definition of Scaffolding :

Scaffolding lets you auto-generate a whole application for a given domain class including:
  • The necessary views
  • Controller actions for create/read/update/delete (CRUD) operations

So if you define for example this domain class :

class User {

String name
String tel
String addr

}
You are excpecting to have html fields in this order. But it's not necessary the case.It's seems that the default order is alphabetical.
If you want to define field order, you have to add the following to the domain class :

statics constraints = {
     name()
     addr()
     tel()
}
  With constraints, you will be able to add validation, constraints ...


No comments:

Post a Comment