You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Richard Hill <ri...@su3analytics.com> on 2010/12/10 11:37:07 UTC

Triggering zone update in component

Hi All,

I have a simple page with a component in it. This component contains a
zone. I would like to be able to update the zone from the parent page. 
At the moment I am using an actionlink handler in the parent to call the
handler in the component - but this results in a full page re-render of
the parent.

So what's the best way of updating a component's zone from it's parent
page?


Many thanks Richard.



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


Re: Triggering zone update in component

Posted by Richard Hill <ri...@su3analytics.com>.
On Fri, 2010-12-10 at 09:09 -0200, Thiago H. de Paula Figueiredo wrote:
> On Fri, 10 Dec 2010 08:37:07 -0200, Richard Hill <ri...@su3analytics.com>  
> wrote:
> 
> > Hi All,
> 
> Hi!
> 
> > I have a simple page with a component in it. This component contains a
> > zone. I would like to be able to update the zone from the parent page.
> 
> First of all, it's a bad practice for a parent page or component to use  
> something from component. It's bad encapsulation.
> 
	I can see why it would be a bad design for a component to call/access
it's parent, but I think there are legitimate cases when you might need
a parent to update a child component. 


> > At the moment I am using an actionlink handler in the parent to call the
> > handler in the component - but this results in a full page re-render of
> > the parent.
> 
> If this ActionLink has a zone parameter, it will work as long as you  
> return a block, component instance, JSONObject, JSONArray or  
> MultiZoneUpdate instance.

What I have actually done now is wrap the component in zone. So now I
can update from the parent and from within the zone itself.


> > So what's the best way of updating a component's zone from it's parent
> > page?
> 
> Remember that what you pass to the zone parameter of ActionLink, EventLink  
> and Form is an HTML id, not a Tapestry t:id. Therefore, all you need is to  
> create an ActionLink with zone="yourZoneClientId".
> 


Cheers


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


Re: Triggering zone update in component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 10 Dec 2010 08:37:07 -0200, Richard Hill <ri...@su3analytics.com>  
wrote:

> Hi All,

Hi!

> I have a simple page with a component in it. This component contains a
> zone. I would like to be able to update the zone from the parent page.

First of all, it's a bad practice for a parent page or component to use  
something from component. It's bad encapsulation.

> At the moment I am using an actionlink handler in the parent to call the
> handler in the component - but this results in a full page re-render of
> the parent.

If this ActionLink has a zone parameter, it will work as long as you  
return a block, component instance, JSONObject, JSONArray or  
MultiZoneUpdate instance.

> So what's the best way of updating a component's zone from it's parent
> page?

Remember that what you pass to the zone parameter of ActionLink, EventLink  
and Form is an HTML id, not a Tapestry t:id. Therefore, all you need is to  
create an ActionLink with zone="yourZoneClientId".

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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