You probably want something like this in the loop. Notice that when the loop is looping, it creates an appropriate myZoneId and actually keeps it in what is sent to the client. When the client clicks on something, it contains the appropriate information so the server knows what zone needs to be updated--even if there are a variable number of zones in the loop.
<loop> <t:zone t:id="${myZoneId}"> Stuff that needs updated when myThing gets changed in ${myThing} </t:zone> <t:actionlink t:id="myActionLink" t:context="myThing" t:zone= "${myZoneId}" t:event="updateZone" /> UpdateZone </t:actionlink> </loop> public String getMyZoneId() { return "myZone-" + myThing.getId(); } public Object onActionFromMyActionLink(Thing myThing) { Do something with myThing and then return a zone update } There may be some errors in this code. I typed it from memory, but it should give you an idea of the approach used to keep track of which link updates which zone. Hope that helps. Mark On Wed, Dec 15, 2010 at 2:31 PM, Tom van Dijk <t...@tvandijk.nl> wrote: > Alright, I suppose can add a context. But I find that it's not only the > "Product" that's null, but also stuff like zones. > > What I have, is a component inside a loop. Now within the component, I have > a zone that I want to update as follows: > <t:loop ...> > <t:zone t:id="overviewOfStuff"> > <t:actionLink t:id="refreshMe" t:context="product.id" > zone="overviewOfStuff"> ... </t:actionLink> > </t:zone> > </t:loop> > > Because it's in a loop, the zone id changes every iteration. > The above piece of code would not actually refresh the zone, but only the > first zone in the loop. I can change it to: > <t:loop ...> > <t:zone t:id="overviewOfStuff"> > <t:actionLink t:id="refreshMe" t:context="product.id" > zone="${overviewOfStuff.clientId}"> ... </t:actionLink> > ... a list of stuff ... > </t:zone> > </t:loop> > > Obviously I need property bindings to @InjectComponent @Property Zone > overviewOfStuff; > > This works, but when I press refresh, the event handler of the component is > called and obviously, Zone is null. There is also no way to retrieve the > client Id. > > Right, how do I do it? > > Regards, > Tom. > > Op 15-12-2010 13:18, Igor Drobiazko schreef: > > Because the product set inside the loop is lost, when the user clicks on >> the >> ActionLink. You need to provide a context for your ActionLink in order to >> restore the state. >> >> On Wed, Dec 15, 2010 at 1:13 PM, Tom van Dijk<t...@tvandijk.nl> wrote: >> >> Hi, >>> >>> In an application, I'm making an editor for products in a group and my >>> client wants everything in one page. So, there are product groups, with >>> products in each group and every product has a number of subproperties, >>> and >>> so on (4 levels deep). So what I get is a loop inside a loop inside a >>> loop. >>> >>> I have a loop with a custom component in it: >>> >>> <tr t:type="loop" source="group.products" value="productInLoop" >>> <t:productEditor product="productInLoop"/> >>> </tr> >>> >>> The Product Editor has >>> @Parameter (required=true) Product product; >>> >>> Now the Product Editor component has an actionLink, and in >>> onActionFromActionLink, product is null. >>> >>> Why? >>> >>> Sincerely, >>> Tom. >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.or >>> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >