You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bhorvat <ho...@gmail.com> on 2012/06/30 11:06:28 UTC

Zone within a Zone problem

I have a Zone and inside I have a component that has a zone, after the first
zone is refreshed the link that refreshes the second zone does not work. Is
there a problem with this combination or am  I missing something? 

                <t:zone t:id="zoneComponent" t:update="show">  
                                <t:if t:test="selectedComponent">  
                                    <t:layout.ComponentData
component="selectedComponent" />     
                                </t:if>             
                </t:zone>

And the Component is 

  <t:zone t:id="zoneReviews" t:update="show">
            <t:eventlink t:event="showAllReviews" zone="zoneReviews"
class="showThumbsButton right">All</t:eventlink>

   // A lot of html code

 </t:zone>

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Hm... I think that normal behavior is that if you have zone with in a zone
once an in nor zone is refreshed it triggers the refresh of the outer zone
as well, is there a way to stop this?

cheers

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714220.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Other code is normal html code. I will show you the code of the link click

    @OnEvent("selectComponent")
    public void selectComponent(ShotComponent component) {
        selectedComponent = component;
        ajaxResponseRenderer.addRender("zoneComponent", zoneComponent); 
    }

I have tried to put in the link in the inner zone and to use the special ^
but the effect is the same, the outer component is updated as well and then
the fact that I have placed the normal id on the inner zone is becoming the
problem because once it is refreshed the links is broken, if I remove the
normal id it works but still the outer zone is updated somehow.... I am
really confused with this :)

cheers

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714219.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
On Sat, Jun 30, 2012 at 7:18 PM, bhorvat <ho...@gmail.com> wrote:
> It seems that the inner zone is not triggering the outer to refresh as well.
> I guess I am just not wiring things up properly as this should not be the
> case. This is what I have
>
>                 <t:zone t:id="zoneData" t:update="show">
>                     <t:layout.ShotDetails  />
>                 </t:zone>
>
> Simplified ShotDetails
>
>   <t:eventlink t:event="selectComponent"  zone="zoneComponent"
>>Link</t:eventlink>
>
>   <t:zone t:id="zoneComponent" id="zoneComponent" t:update="show">
> other stuff </t:zone>
>
> So once the link is clicked it refreshes the zoneData as well as
> zoneComponent, which should not be the case, right?

Yes. Can we see more code please?

>
> cheers
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714216.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
It seems that the inner zone is not triggering the outer to refresh as well.
I guess I am just not wiring things up properly as this should not be the
case. This is what I have

                <t:zone t:id="zoneData" t:update="show">                    
                    <t:layout.ShotDetails  />             
                </t:zone>

Simplified ShotDetails

  <t:eventlink t:event="selectComponent"  zone="zoneComponent"
>Link</t:eventlink>   

  <t:zone t:id="zoneComponent" id="zoneComponent" t:update="show">     
other stuff </t:zone>

So once the link is clicked it refreshes the zoneData as well as
zoneComponent, which should not be the case, right? 

cheers

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714216.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
On Sat, Jun 30, 2012 at 7:06 PM, bhorvat <ho...@gmail.com> wrote:
> Well that was my starting point where I encountered the problem in the first
> place. Once the outer zone refreshes it changes the zone id and the link
> does not work any more. The zone id is change but the link that was pointing
> to that zone is not changed
>
> But now I get where I was wrong I didnt put normal id only t:id
>
> <t:zone t:id="innerZone" id="innerZone" />
>
> Can you please explain why is the normal id important in this case? I was
> under the impression that t:id would be converted to id at the end.
>

t:id is the server side id (unique for the template). The client id in
the generated html doesn't have to be the same. If you have one
instance of the component then most frequently it's the same, but if
the component is lets say in a loop than of you have t:id="mydiv"
you'll can get client id's like "mydiv" "mydiv_0", "mydiv_1" etc. Now
the zone component has and "id" parameter that let's you specify what
it's client id is gonna be (see the docs [1]). This is because the
zone's client id is an
important parameter. This is what was happening in your case. You
might as well bind the zone's id with a Property in the java class
etc. It doesn't have to be the same as the t:id.

[1] http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Zone.html

> Cheers and thanks for patience
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714215.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Well that was my starting point where I encountered the problem in the first
place. Once the outer zone refreshes it changes the zone id and the link
does not work any more. The zone id is change but the link that was pointing
to that zone is not changed 

But now I get where I was wrong I didnt put normal id only t:id 

<t:zone t:id="innerZone" id="innerZone" /> 

Can you please explain why is the normal id important in this case? I was
under the impression that t:id would be converted to id at the end.

Cheers and thanks for patience 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714215.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,
On Sat, Jun 30, 2012 at 4:30 PM, bhorvat <ho...@gmail.com> wrote:
> Hi,
>
> Can you please help me with the first approach since the second one is great
> if the link is surrounded by the zone it needs to refresh but if it is
> not...
>
> so I have
>
> <outer zone>
>
>    <link>
>
>    <zone that I want to refresh>
>
> How do I use zone.getClientId(), where do I put it, in the link? or in the
> zone, or both? I tried a bunch of option but no luck

Here you have the case where the link is rendered before the zone it
refreshes. This means that the clientId of zone you want to refresh is
not yet generated. Just bind the id parameter explicitly.
Do this:

<t:zone t:id="outerZone" />
    <t: eventLink zone="innerZone" ... />
    <t:zone t:id="innerZone" id="innerZone" />


>
> cheers
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714212.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Hi,

Can you please help me with the first approach since the second one is great
if the link is surrounded by the zone it needs to refresh but if it is
not...

so I have 

<outer zone>

   <link>

   <zone that I want to refresh>

How do I use zone.getClientId(), where do I put it, in the link? or in the
zone, or both? I tried a bunch of option but no luck

cheers


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714212.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Ok tnx it is good to know :D

cheers

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714205.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
On Sat, Jun 30, 2012 at 1:31 PM, bhorvat <ho...@gmail.com> wrote:
> Solution #2 works greate, thanks for that.
> It is strange that once the zone is updated and changes the id's it does not
> change the id's of those components/links that depend on that id

It changes the client id's. You are talking mainly about server
parameters that are later used mainly in javascript. I don't think
what you are suggesting is even possible. Once you get used to it
believe me it's not a problem at all.

Cheers

>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714200.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Zone within a Zone problem

Posted by bhorvat <ho...@gmail.com>.
Solution #2 works greate, thanks for that.
It is strange that once the zone is updated and changes the id's it does not
change the id's of those components/links that depend on that id

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194p5714200.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone within a Zone problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,
After the update of the first zone - the second zone's Id is changed
(tapestry does this when the zone updates). Check with firebug or
something.

Solution:
1: Inject the zone and take make getClientId() (to take the generated id)
2: From the docs in http://tapestry.apache.org/ajax-and-zones.html
"If the Form or Link is enclosed by the Zone itself, then the zone
parameter may be set to the special value ^. The carat is evaluated,
on the client side, by searching up form the form or link element for
the first enclosing element with the t-zone CSS class. In this way,
the client-side coordination can occur without having to know what the
specific client-side id of the Zone is. Because of this, in many
cases, it is no longer necessary to specify the Zone's id parameter."

Just do  <t:eventlink t:event="showAllReviews" zone="^"


Cheers,
Dragan Sahpaski


On Sat, Jun 30, 2012 at 11:06 AM, bhorvat <ho...@gmail.com> wrote:
> I have a Zone and inside I have a component that has a zone, after the first
> zone is refreshed the link that refreshes the second zone does not work. Is
> there a problem with this combination or am  I missing something?
>
>                <t:zone t:id="zoneComponent" t:update="show">
>                                <t:if t:test="selectedComponent">
>                                    <t:layout.ComponentData
> component="selectedComponent" />
>                                </t:if>
>                </t:zone>
>
> And the Component is
>
>  <t:zone t:id="zoneReviews" t:update="show">
>            <t:eventlink t:event="showAllReviews" zone="zoneReviews"
> class="showThumbsButton right">All</t:eventlink>
>
>   // A lot of html code
>
>  </t:zone>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-within-a-Zone-problem-tp5714194.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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