Re: parent component content modification
Re: parent component content modification
- Subject: Re: parent component content modification
- From: Jean-Francois Veillette <email@hidden>
- Date: Thu, 28 Oct 2010 14:33:53 -0400
Le 2010-10-28 à 14:21, Michael Gargano a écrit :
> if i have a page template component...
>
> <html>
> <head>
> <webobject name="headStuff"/>
> </head>
> <body>
> <webobject name="pageContent"/>
> </body>
> <webobject name="endScript"/>
> </html>
>
> in my wod...
>
> endScript : WOJavaScript {
> }
>
>
> is there a way in a sub-compoent (that would provide the body content) to change the properties of that endScript component? maybe sometimes i want to reference external src, other times i may want to have script between the <script></script> tags, other pages may do nothing with it, but i want it as a placeholder in my template. is this possible?
yes ... here is a way ...
in your parent page, have something like:
String _appendToEndScript = "";
public void addToEndScript(String stuff) { _appendToEndScript += stuff; }
public String appendToEndScript() { return _appendToEndScript; }
in the parent page, have something like:
endScript : WOJavaScript {
value = appendToEndScript; // not sure about that binding, check the wojavascript api
}
or
<script><wo:str value="$appendToEndScript" /></script>
Then down the tree, you call;
frameworkComponent.appendToEndScript("alert('hi');");
where frameworkComponent is that component, either by frameworkComponent=parent(); or frameworkComponent=context().page(); or by binding frameworkComponent=this;
jfv
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden