有没有办法在Grails 3脚手架视图中显示ID列,以便允许编辑它并在创建新条目时手动指定它?默认情况下,在域类映射中指定为id
的列在列表视图中是不可见的,show
或edit
或create
。但有时候,我需要在那里看到ID并能够手动更改它。怎么做?
好的,找到了!因此,为了指定要在这些视图中呈现的字段,请转到相应的*.gps
文件,例如edit.gsp
和文件的底部,将<f:all bean="<name>"/>
更改为明确的列列表,如下所示:
<f:with bean="<name>">
<f:field property="frequency"/>
<f:field property="unit"/>
<f:field property="description"/>
<f:field property="lang"/>
</f:with>
......它已经完成了!唯一的例外是列表所在的index
。要更改该值,请编辑index.gsp
以反映f:table collection
标记中的特定属性:
<f:table collection="${aliasFrequencyDictList}" properties="['frequency','unit','description','lang']"/>