You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org> on 2008/02/08 16:05:12 UTC

[jira] Updated: (TAPESTRY-1916) updateComponents doesn't peek for client id in For loop

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

Jesse Kuhnert updated TAPESTRY-1916:
------------------------------------

    Fix Version/s:     (was: 4.1.5)
                   4.1.6

> updateComponents doesn't peek for client id in For loop
> -------------------------------------------------------
>
>                 Key: TAPESTRY-1916
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1916
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.1.3
>         Environment: any
>            Reporter: Jesse Kuhnert
>             Fix For: 4.1.6
>
>
> From the mailing list:
> I spent three hours on this silly thing so I hope this post will help you
> avoid that!
> I was testing this out with two iterations of the loop, and that's what
> caused me grief. As soon as I switched to four iterations, I figured out
> what was happening:
> I have a SimplePage.html which includes this:
> < span jwcid="@For" source="ognl:wordList" value="ognl:word"
> index="ognl:objectIndex" >
>   < a href="#" jwcid="@DirectLink" updateComponents="componentWrapper"
> listener="listener:showTheWord" parameters="ognl:word">Show the word
>   < p>
>      < span jwcid="componentWrapper@Any">
>         < div jwcid="showWordComponent"/>
>      < /span>
>   < /p>
>   < /span>
> < /span>
> I look at the generated page source and the clientId's within the
> @DirectLink links don't look right:
> < span id="For">
> < a id="DirectLink"
> href="/playing/SimplePage,$DirectLink.direct?sp=Sfirst&amp;updateParts=componentWrapper"
> onclick="return tapestry.linkOnClick(this.href,'DirectLink', false)">Show
> the word
> < p>
>   < span id="componentWrapper">
> Word:
>   < /span>
> < /p>
> < /span>
> < a id="DirectLink_0"
> href="/playing/SimplePage,$DirectLink.direct?sp=Ssecond&amp;updateParts=componentWrapper"
> onclick="return tapestry.linkOnClick(this.href,'DirectLink_0', false)">Show
> the word
> < p>
>   < span id="componentWrapper_0">
> Word:
>   < /span>
> < /p>
> Look at the second link... it still shows 'updateParts=componentWrapper'
> when it should be 'updateParts=componentWrapper_0'.
> The solution to this is trivial (once you know what's going on!). Simply
> move the directlink code below the component in question, so we have:
> < span jwcid="@For" source="ognl:wordList" value="ognl:word"
> index="ognl:objectIndex" >
>   < p>
>      < span jwcid="componentWrapper@Any">
>         < div jwcid="showWordComponent"/>
>      < /span>
>   < /p>
>   < a href="#" jwcid="@DirectLink" updateComponents="componentWrapper"
> listener="listener:showTheWord" parameters="ognl:word">Show the word
>   < /span>
> < /span>
> Now the links will be correct. The reason this happens is that the
> @DirectLink component will ask for the componentWrapper clientId on the
> first round, and it will default to the componentId because the clientId has
> not been set yet because componentWrapper has not been rendered. The second
> time around, the @DirectLink will still have the wrong value because it
> renders before the componentWrapper.
> I hope all that was clear.... if not, please ask questions and I'll be happy
> to re-write and re-word it.
> Jim

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