You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gerold Glaser <ge...@gmail.com> on 2011/06/15 12:39:05 UTC

Problem with Nested Zones and Eventlink

Dear Listeners!

I have a problem with nested zones and eventlinks and the default id
generation of the zone id after zone updates. If the parameter id of the
zone is bound than everything works fine. But in some situations I cannot
provide a unique zone id. (e.g. Loops, ...).

In the beginRender of the AbstractComponentEventLink the function
clientBehaviorSupport.linkZone(getClientId(), zone, link); gets called.
Afterwards the zoneId is bound to the eventlink in the javascript
updateZoneOnEvent function with: var zoneElement = zoneId == '^' ?
$(element).up('.t-zone') : $(zoneId);
Due to the default id generation in the zone component the eventlink's zone
parameter referes to a zone id that does not exists anymore.

Please have a look on this example:

public class TestPage
{
    @InjectComponent
    private Zone outerZone, innerZone;

    @OnEvent(value = "refreshOuterZone")
    Object onRefreshOuterZone()
    {
        return outerZone;
    }

    @OnEvent(value = "refreshInnerZone")
    Object onRefreshInnerZone()
    {
        return innerZone;
    }
}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns:p="tapestry:parameter">

<body>
<t:eventLink event="refreshOuterZone" zone="outerZone">Refresh Outer
Zone</t:eventLink>
<t:zone t:id="outerZone" update="show">
<t:eventLink event="refreshInnerZone" zone="innerZone">Refresh Inner
Zone</t:eventLink>
<t:zone t:id="innerZone" update="show">
<p>I am the inner Zone</p>
</t:zone>
</t:zone>
</body>
</html>

Maybe the eventlink could get a zone component and not just the name of the
zone to access the 'correct' client id of the zone in the eventlink.

Best regards,
Gerold

Re: Problem with Nested Zones and Eventlink

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Jun 2011 07:39:05 -0300, Gerold Glaser  
<ge...@gmail.com> wrote:

> Dear Listeners!

Hi!

> I have a problem with nested zones and eventlinks and the default id
> generation of the zone id after zone updates. If the parameter id of the
> zone is bound than everything works fine. But in some situations I cannot
> provide a unique zone id. (e.g. Loops, ...).

When you have something inside a zone that you need to get a reference to  
it after an AJAX update you should provide the id's yourself. ;)

-- 
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