Select Grails3.2.2从域约束中选择选项
可以用域的Select Grails3.2.2从域约束中选择选项,select,grails,groovy,Select,Grails,Groovy,可以用域的约束中的可用选项填充的选项吗 static constraints = { variable(inList: ["value1", "value2", "value3"]) } 您可以通过以下方式访问列表: YourClass.getConstrainedProperties().yourProperty.inList 您可以在g:each循环中使用它来创建选择选项,或者使用g:select标记:感谢@Joshua Moore添加g:select标记作为替代解决方案,而不是
约束中的可用选项填充
的选项吗
static constraints = {
variable(inList: ["value1", "value2", "value3"])
}
您可以通过以下方式访问列表:
YourClass.getConstrainedProperties().yourProperty.inList
您可以在g:each
循环中使用它来创建选择选项,或者使用g:select
标记:
感谢@Joshua Moore添加g:select标记作为替代解决方案,而不是使用g:each。绝对是更好的方式和方式去!