是否可以用域constraints
中的可用选项填充<select>
的选项
static constraints = {
variable(inList: ["value1", "value2", "value3"])
}
您可以通过以下方式访问列表:
YourClass.getConstrainedProperties().yourProperty.inList
您可以在g:each
循环中使用它来创建选择选项或使用g:select
标记,如下所示:<g:select from="${YourClass.getConstrainedProperties().yourProperty.inList}" />