(Quick Reference)
mvcGroupInit(Map args)
Purpose
Initialization hook for MVC members.
Examples
class SampleController {
def someProperty
def mvcGroupInit(Map args) {
someProperty = args.random
}
}
Description
This method serves as an initialization hook for any MVC member that is not a Script nor a CompositeBuilder instance. It will be called right after an instance has been created. The args parameter holds any additional data that pas passed to either
createMVCGroup()
or
buildeMVCGroup()
; you can use it to share MVC instances cmember for example, like it's done in the following snippet
class SampleController {
def model
def mvcGroupInit(Map args) {
assert model instanceof SampleModel
createMMVCGroup('Other', [model, model, foo: 'FOO'])
}
}
//
class OtherController {
def model
def mvcGroupInit(Map args) {
assert model instanceof SampleModel
assert args.foo == 'FOO'
}
}