You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Juan Germán Castañeda Echevarría (JIRA)" <ji...@apache.org> on 2010/01/29 23:25:34 UTC

[jira] Updated: (TAP5-255) Easy management of zones inside a loop

     [ https://issues.apache.org/jira/browse/TAP5-255?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juan Germán Castañeda Echevarría updated TAP5-255:
--------------------------------------------------

    Attachment: select.diff
                Test.tml
                Test.java

This is a little example of the problem with zones inside loops and a patch for Select.java. The expected behaviour of the test is to get each select to update only the zone generated in its iteration but every select updates only the first one created in the loop.

I solved this in my application by creating a second component that only renders the body of the loop, removing the zone parameter from the select and making renderSupport to write the needed javascript (addInit("updateZoneOnEvent", spec)) in the afterRender phase so that I could get the real clientId of the zone.

That is very ugly since I had to hardcode the event link in order to make it send the event to the Select object (because it has the necessary code to inject any input tag to its containing form in the onChange() method) or otherwise I'd get the "component must be enclosed by a Form component" error.

I think this can be fixed by setting the zone parameter defaultPrefix to  BindingConstants.COMPONENT, putting the zone's clientId in the spec and deferring the renderSupport.addInit("updateZoneOnEvent", spec); with a heartbeat as I'm doing in the patch I attached and maybe a new coercion between string and zone can be implemented in order to get the desired result when the zone you want to update is not embedded in the component but it is in a container of it (and not inside a loop, obviously).

All that should be done in every component that has a zone parameter to get the desired effect.

Sorry for the long comment.

> Easy management of zones inside a loop
> --------------------------------------
>
>                 Key: TAP5-255
>                 URL: https://issues.apache.org/jira/browse/TAP5-255
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>            Reporter: Stéphane Decleire
>         Attachments: select.diff, Test.java, Test.tml
>
>
> Enhancing the management of zones inside loops by removing the following zone limitation :
> "Unlike many other situations, Tapestry relies on you to specify useful and unique ids to Zone components, then reference those ids inside ActionLink components. 
> Using Zone components inside any kind of loop may cause additional problems, as Tapestry will uniqueify the client id you specify (appending an index number)."

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