Thanks guys! I have a lot of components that are re-used either in loops, or just embedded in multiple components (often in the same page).
The pattern that Paul and Thiago are suggesting works fine if that component occurs a single time on a page. However, if you use it multiple times, the client side zoneId (as well as the Tapestry JS initializers) are not unique any more, which causes the same zone to be updated all the time, no matter which EventLink got the click. Example Page.tml: <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> <t:component/> <t:component/> </html> Component.tml: <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> <t:eventlink t:id="link" zone="aZone">click me</t:eventlink> <t:zone t:id="aZone" id="aZone"> ${counter} </t:zone> </t:container> In this case, no matter which link you click, the first component will get updated because the zone in the first and the 2nd have the same client side id. Hence my looking around for a solution that would allow me to do this in .tml only as per my original mail. "component:" seemed to be a solution as per the documentation (see below), but doesn't do the trick. In other words, it would be nice if there was a component binding that did the equivalent of this: .java @InjectComponent @Property Zone aZone; .tml "prop:aZone.clientId" Cheers! Jochen On Mar 6, 2012, at 11:30 PM, Paul Stanton wrote: > Why not just use: > > <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> > <t:eventlink zone="aZone"/> > <t:zone t:id="aZone" id="aZone" /> > </t:container> > > ? > > On 7/03/2012 4:18 PM, Jochen Frey wrote: >> Hi! >> >> A general pattern for an Eventlink with an Ajax zone can look something like >> this: >> >> X.java: >> public class CTest { >> @InjectComponent @Property private Zone aZone; >> } >> >> X.tml: >> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> >> <t:eventlink zone="prop:aZone.clientId"/> >> <t:zone t:id="aZone"/> >> </t:container> >> >> >> Where in essence I use a @Property in Java to generate the correct clientId >> for the t:zone parameter to the eventlink. >> >> I was wondering if there's a way to guarantee the correct clientID (not the >> t:id) without going through a Java @Property. >> >> >> Looking at the documentation one might hope that something like this would >> work: >> >> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> >> <t:eventlink zone= >> "component:aZone" >> /> >> <t:zone t:id="aZone"/> >> </t:container> >> >> >> But "component:aZone" doesn't get the ID (which I expected from the >> documentation here: Binding Expressions - component: >> http://tapestry.apache.org/component-parameters.html), but instead I gets >> the actual Zone Object (which is great for many other use cases). >> >> And as far as I can tell, it's not possible to do something like this (see >> below) either: >> >> "component:aZone.clientId" >> >> Am I missing something, or is it simply a requirement to go through the java >> class? >> >> Thanks so much! >> Jochen >> --- >> joc...@jochenfrey.com >> +1.415.366.0450 >> @jochen_frey >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> --- joc...@jochenfrey.com +1.415.366.0450 @jochen_frey --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org