You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jan Vissers <Ja...@cumquat.nl> on 2008/04/14 15:26:32 UTC

Re: Accessing a containing component parameter from within a 'child' component

I believe there is something mentioned on it on:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/parameters.html#Inherited%20Parameter%20Bindings
with inherit: binding - however this doesn't work for me.

-J.

On Mon, 2008-04-14 at 15:18 +0200, Jan Vissers wrote:
> Hi,
> 
> I have an embedded component which should render something different
> depending on a component parameter of the component containing the
> embedded component (wow - try to say that quickly ;-).
> 
> How can I do that?
> 
> -J.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Accessing a containing component parameter from within a 'child' component

Posted by Jan Vissers <Ja...@cumquat.nl>.
Yep, you're right!

Thanks for the example.

-J.

On Mon, 2008-04-14 at 16:09 +0200, Christian Koeberl wrote:
> > inherit: binding - however this doesn't work for me.
> That should work.
> 
> With the inherit keyword you can forward parameters to sub-components, 
> like this example of a zebra Grid component:
> 
> public class MyGrid
> {
>         @Parameter(required = true)
>         private GridDataSource source;
> 
>         @Parameter
>         private BeanModel model;
> 
>         @Parameter(defaultPrefix = TapestryConstants.
> LITERAL_BINDING_PREFIX)
>         private String reorder;
> 
>         @Component(inheritInformalParameters = true, parameters =
>         { "rowClass=cycle:odd,even", "source=inherit:source",
>                 "model=inherit:model", "reorder=inherit:reorder" })
>         private Grid grid;
> }
> 
> -- 
> Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Accessing a containing component parameter from within a 'child' component

Posted by Christian Koeberl <ch...@porsche.co.at>.
> inherit: binding - however this doesn't work for me.
That should work.

With the inherit keyword you can forward parameters to sub-components, 
like this example of a zebra Grid component:

public class MyGrid
{
        @Parameter(required = true)
        private GridDataSource source;

        @Parameter
        private BeanModel model;

        @Parameter(defaultPrefix = TapestryConstants.
LITERAL_BINDING_PREFIX)
        private String reorder;

        @Component(inheritInformalParameters = true, parameters =
        { "rowClass=cycle:odd,even", "source=inherit:source",
                "model=inherit:model", "reorder=inherit:reorder" })
        private Grid grid;
}

-- 
Chris