Heschoon
Heschoon

Reputation: 3017

Accessing controller params in json views in Grails

A controller using json views will call the json view corresponding to the controller method called when rendering domains.

I want however to pass the controller params to the json view in addition to the domains, to customize the way a domain is rendered.

A typical example of the use of such a feature is to either display the domains rendered in an index endpoint in a short or detailed way.

How can I make pass the controller params to the json view?

Upvotes: 0

Views: 57

Answers (1)

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27255

How can I make pass the controller params to the json view?

You don't have to do anything. You can reference the params variable in a JSON view. We provide direct access that way.

For more info, see the "Accessing The Request" section at http://views.grails.org/latest/.

Upvotes: 2

Related Questions