You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by rmkkk <re...@gmail.com> on 2009/04/10 16:03:02 UTC

Problem using many times the same component on one page

Hello,

I have a component I want to inject two times in the same page. I want to
display a block when clicking on an edit button. With one component no
problem. With two components when I click on the edit button of my second
component, it's the block of the first component which is displayed.

The strange thing is that another link works fine, I can  which didn't work
before adding clientId. But with my other zone 'configZone' I can't use
clientId, I get an exception.

How can I correct that ?

I join my tml and java files.
http://www.nabble.com/file/p22988449/SportTopOdds.java SportTopOdds.java 
http://www.nabble.com/file/p22988449/SportTopOdds.tml SportTopOdds.tml 
-- 
View this message in context: http://www.nabble.com/Problem-using-many-times-the-same-component-on-one-page-tp22988449p22988449.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: Problem using many times the same component on one page

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Using clientId with zones can be a little bit tricky if you don't 
understand how clientIds are generated, and how they will change after 
the zone is reloaded, etc etc.  And will probably will not work when you 
try to load the zone the second time.  And using getClientId on a zone 
won't work if the zone component is not rendered ( which is the case 
here, since you're only rendering a block, not the whole page )...



I would simply have a static/literal id for your zone, it'll be more 
reliable.

<t:zone id="zoneId">
   <a t:type="actionlink" zone="zoneId">...</a>
</t:zone>




If you're creating a zone in a loop, then you'll have to generate that 
zoneId deterministically through a property ( maybe by embedding the 
object's id that you're looping through, etc )..

<t:loop source="values" value="value">
<t:zone id="prop:zoneId">
   <a t:type="actionlink" zone="prop:zoneId">...</a>
</t:zone>
</t:loop>

public String getZoneId() {
   return "zoneId"+value.getId();
}





rmkkk wrote:
> Hello,
> 
> I have a component I want to inject two times in the same page. I want to
> display a block when clicking on an edit button. With one component no
> problem. With two components when I click on the edit button of my second
> component, it's the block of the first component which is displayed.
> 
> The strange thing is that another link works fine, I can  which didn't work
> before adding clientId. But with my other zone 'configZone' I can't use
> clientId, I get an exception.
> 
> How can I correct that ?
> 
> I join my tml and java files.
> http://www.nabble.com/file/p22988449/SportTopOdds.java SportTopOdds.java 
> http://www.nabble.com/file/p22988449/SportTopOdds.tml SportTopOdds.tml 

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