chip
chip

Reputation: 3279

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

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.

Upvotes: 8

Views: 5279

Answers (1)

Tomas Lin
Tomas Lin

Reputation: 3532

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

Upvotes: 16

Related Questions