Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide fields on the view part of the Grails CRUD dynamic scaffolding?

Tags:

grails

I was wondering if there is another way of making a certain field of a domain to not appear in the views pages of the dynamic scaffolding capability of Grails?

I can execute the generate-all command on the domain and edit the view myself but I was just wondering if there is a way for me to still take advantage of the dynamic scaffolding capability.

I just want to not show the password field on the show and edit views of my user domain.

like image 850
chip Avatar asked Jul 27 '12 09:07

chip


1 Answers

I would disagree with Gregg's comment above. Scaffolding is very helpful in reducing unnecessary code.

Add a constraint called display:false to that property in your domain class, i.e,

static constraints { 
   password display: false
}

This will hide the property for you when scaffolding.

Docs: http://www.grails.org/doc/latest/ref/Constraints/Usage.html

like image 190
Tomas Lin Avatar answered Nov 16 '22 02:11

Tomas Lin