Reputation: 289
Im stuck again. Its very frustrating coming from a ruby background.
I have 3 domains. Domain A has many domain B's. Domain A hasMany Domain C's
I want to be able to access domain C's records in domain B's view so a user can select a domain C template and have it inserted into the textarea of domain B's edit/create field. Obviously this will come after with javascript.
The story - A user creates a publication which is attached to a portfolio. The user when creating or editing a publication can choose a template to insert into a publication. The user should be able to choose from a list of templates assigned to the portfolio and when they choose a template from a list, it automaticaly inserts to the textarea of that publication during edit or create.
My issue is that I cannot get domain C to load any results in the domain B view. Nothing at all. I have tried g:select, g:link, href, what ever I try I can seem to get any results showing.
The views/controllers are standard template generated.
My domains/models are as follows
class Portfolio {
static hasMany = [publications:Publication, pubtempl: Templatepublication]
class Publication {
static belongsTo = [portfolio: Portfolio]
class Templatepublication {
Cstatic belongsTo = [portfolio: Portfolio]
Edit:
this is the gsp page tags being used
<g:select name="templatepublication.id"
from="${spotlight.pubtemplates.Templatepublication.list()}"
optionKey="id" required=""
value="${portfolioInstance?.pubtempl?.id}" class="many-to-one"/>`
Upvotes: 0
Views: 133
Reputation: 13475
What are trying to do "in domain B view"? Can you post your view code?
Like this? (I mostly copied a grails documentation example)
<g:select name="bInstance.a.c.id"
from="${C.list()}"
value="${bInstance.a?.c?.id}"
optionKey="id" />
Upvotes: 1