Question

Is there a way to associate the PropertyEditor to a specific Controller.

I might want to have two PropertyEditor's for DateTime class, and want to associate them to different controllers.

or a domain class with 2 Date field, one need change 2010-12-23 to date, another need 2010-12-23 10:00:01

Was it helpful?

Solution

There is no way to associate with a Controller. PropertyEditorRegistrar has only two signatures for registerCustomEditor(): for a whole property class, and for a property name. The second signature didn't work before Grails 1.3.6, it's a bug GRAILS-6592. So

registry.registerCustomEditor(Date.class, 'startDate', new MyDateAddressEditor())

will work since Grails 1.3.6.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top