[
https://issues.apache.org/jira/browse/TAP5-893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766146#action_12766146
]
Deian Ivanov commented on TAP5-893:
-----------------------------------
Actually further debugging showed that the problem is the generated code from
the block itself.
Here is the code in the template :
<t:zone t:id="zz2" style="border: 2px solid green; width:
100px; height: 100px;">
<t:slot id="pp2"/>
</t:zone>
and here is the code placed as a result from the ajax call:
<div id="zz2-124595c2131" class="t-zone" style="border: 2px solid green; width:
100px; height: 100px;">
This is block #2;
So Tapestry is trying to create generate an unique ID and is adding a suffix to
do so. However in that case this is not necessary.
> Nested zone elements problem : changes the HTML DOM and due that the tag
> cannot be find
> ----------------------------------------------------------------------------------------
>
> Key: TAP5-893
> URL: https://issues.apache.org/jira/browse/TAP5-893
> Project: Tapestry 5
> Issue Type: Bug
> Affects Versions: 5.1.0.5
> Reporter: Deian Ivanov
>
> Hi guys,
> Here is a problem I stumbled upon today. I have to create a page with two
> nested tabsets.
> I put together a quick tabset component.
> I found out that I cannot put two nested zones since the id parameter of the
> zone must me string and that string cannot be fed from ${var} ??!
> We must change that or perhaps one of those magical prefixes can do the job?
> Anyways the ui of the two tabsets had to be different so created a second
> tabset component with a different zone id.
> However, when I play a bit with the tabsets it happens that the second(the
> nested) tabset stops working and FF reports an error in Tapestry.js
> function $T(element) {
> var e = $(element);
> var t = e._tapestry; <=== e is null
> It is obvious that once the Ajax response returns a new block the ids are
> changed and the ${} function doesn't work already. However
> document.getElementByID() still ugly and still works and perhaps we can
> change the Tapestry.js to accommodate those cases?
> And in general how do we change that file? I'd go one step further to find
> and suggest a solution but how do we access that file?
> Cheers,
> Deian
> Here is the simple code:
> NestedZones.tml
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
>
> ${Name}<br/>
> <hr/>
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp1" >#1->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp2" >#2->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp1" >#1->2</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp2" >#2->2</a>
> <br/>
> <hr/>
>
> <t:zone t:id="zz1" style="border: 2px solid red; width: 300px;
> height: 300px;">
> <t:slot id="pp1"/>
> </t:zone>
> <t:block id="pp1">
> This is block #1;
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp1" >#1->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp2" >#2->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp1" >#1->2</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp2" >#2->2</a>
> <br/>
> <t:zone t:id="zz2" style="border: 2px solid green;
> width: 100px; height: 100px;">
> <t:slot id="pp2"/>
> </t:zone>
> </t:block>
>
> <t:block id="pp2">
> This is block #2;
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp1" >#1->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz1"
> t:context="literal:pp2" >#2->1</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp1" >#1->2</a>
> <br/>
> <a t:type="EventLink" event="click" zone="zz2"
> t:context="literal:pp2" >#2->2</a>
> <br/>
> </t:block>
>
> </html>
> and the NestedZones.java
> import org.apache.tapestry5.Block;
> import org.apache.tapestry5.ComponentResources;
> import org.apache.tapestry5.MarkupWriter;
> import org.apache.tapestry5.annotations.BeforeRenderBody;
> import org.apache.tapestry5.annotations.Component;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.EventLink;
> import org.apache.tapestry5.ioc.annotations.Inject;
> public class NestedZones {
>
> @Inject
> private ComponentResources resources;
>
> //@Component(parameters = {"event=click"})
> //private EventLink click1, click2, click3;
> Object onClick(String s) {
> Block toRender = null;
> ComponentResources scanResources = resources;
> while(scanResources != null) {
> toRender = scanResources.findBlock(s);
> scanResources = scanResources.getContainerResources();
> // try to scan upper level
> }
> return toRender;
> }
>
> public String getName() {
> return "Zones Test";
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.