Pab*_*sby 3 grails groovy select
是否可以<select>在域的域中将可用选项填充为constraints
static constraints = {
variable(inList: ["value1", "value2", "value3"])
}
Run Code Online (Sandbox Code Playgroud)
您可以通过以下方式访问列表:
YourClass.getConstrainedProperties().yourProperty.inList
Run Code Online (Sandbox Code Playgroud)
您可以在g:each循环中使用它来创建您的选择选项,也可以g:select像这样使用标记:<g:select from="${YourClass.getConstrainedProperties().yourProperty.inList}" />