One can 开发者_运维问答specify the order of view elements in GSP file by specifying it in the validation block of the corresponding domain class. If the lass is inherited, the parameter of parent class is always displayed first. For eg
class A {
string a
String b
static constraints = {
b()
a()
}
}
class B extends A{
String c
String d
static constraints = {
d()
c()
b() //parameter from the parent
a() //parameter from the parent
}
}
the order is b,a,d,c. How can I make it d,c,b,a not tampering with gsp.
thanks..
In the constraints for class A, define the constraints in the order you want them to be displayed:
static constraints = {
d()
c()
b()
a()
}
Even if there is no constraint, leave the entry with an empty () to create the order. This only works with scaffolding though.
精彩评论