Display a domain transient property in scaffolded views

我的梦境 提交于 2019-12-01 06:05:19
lo_toad

By default grails doesn't create the fields in views for transient properties. You could manually add them on each view or if you have a lot of them and are using the scaffolded views you could do the following:

Install the view templates:

grails InstallTemplates

Then open the relevant templates in src/templates/scaffolding

and modify the line that reads:

persistentPropNames = domainClass.persistentProperties*.name

to

persistentPropNames = domainClass.properties*.name

for each of the templates. This is a bit of a bodge, but it should work and you can further edit the template to include/exclude any properties you like.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!