You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org> on 2008/06/25 01:13:45 UTC

[jira] Commented: (TAPESTRY-2472) incorrect zone id javascript mapping with page having more than 1 of same component containing a zone

    [ https://issues.apache.org/jira/browse/TAPESTRY-2472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12607800#action_12607800 ] 

Howard M. Lewis Ship commented on TAPESTRY-2472:
------------------------------------------------

The problem is that the zone parameter of the ActionLink component is a simple string, whereas the Zone component's id may be uniqued.

The solution is to inject the Zone component so that it's clientId property can be obtained and passed as the zone parameter of the ActionLink.

Recent changes to Zone mean that it is also easier to set a specific id for the Zone (that is, if you bind the id parameter of the Zone then that is the exact value used; you are responsible for ensuring it is adequately unique).

I'd like to close this issue, I don't think there's a bug here (better documentation is a seperate issue).

> incorrect zone id javascript mapping with page having more than 1 of same component containing a zone 
> ------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2472
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2472
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Core Components, JavaScript, tapestry-core
>    Affects Versions: 5.0.13, 5.0.14
>         Environment: jetty 6.1.9, java 1.6, os x, linux
>            Reporter: Mike Oestereter
>
> When a page contains more than one of the same component (either multiple inclusions or inside a loop) and the component contains a zone with an actionlink that updates this zone then only the zone of the first component instance gets updated in all actionlink-clicks of all components.
> It appears as if the Tapestry javascript initialization mapping parameters are incorrect:
> This is what gets generated:
> Tapestry.DEBUG_ENABLED = true;
> Tapestry.onDOMLoaded(function() {
> Tapestry.init({"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1"]]});
> });
> It should be:
> ...
> Tapestry.init({"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1_0"]]});
> ...
> Below is more detailed information including code examples:
> I get the correct result after clicking on
> the "update: two" hyprlink (the correct zone is updated):
> update: one (hyperlink)
> UPDATED two
> BUT when I modify the page .tml and put the body inside a
> <html><body>...</body></html> in stead of only inside a
> <html>...</htm>
> The following html source get generated by tapestry at the bottom of
> the page and...
> <!--
> Tapestry.DEBUG_ENABLED = true;
> Tapestry.onDOMLoaded(function() {
> Tapestry.init({"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1"]]});
> });
> // -->
> ...and the result is incorrect ("zone1_0" should have been updated and
> not "zone1"):
> UPDATED two
> update: two (hyperlink)
> Here is all the code:
> Page code:
> ZonePage.tml
> <html xmlns:t = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>    <t:zonecomp>one</t:zonecomp>
>    <br/>
>    <t:zonecomp>two</t:zonecomp>
> </html>
> public class ZonePage {
> }
> Component Code:
> ZoneComp.tml
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>    <t:zone t:id="zone1" visible="true">
>        <t:delegate to="prop:activeBlock"/>
>    </t:zone>
>    <t:block t:id="beforeUpdate">
>        <t:actionlink t:id="update" zone="zone1">update:
> <t:body/></t:actionlink>
>    </t:block>
>    <t:block t:id="afterUpdate">
>        <p>UPDATED <t:body/></p>
>    </t:block>
> </t:container>
> public class ZoneComp {
>    @Persist("session")
>    private boolean updated = false;
>    @Inject
>    private Block beforeUpdate;
>    @Inject
>    private Block afterUpdate;
>    @Component(id="zone1")
>    private Zone zone;
>    public Object onActionFromUpdate() {
>        updated = true;
>        return zone;
>    }
>    public Object getActiveBlock() {
>        if (updated) return afterUpdate;
>        return beforeUpdate;
>    }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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