Hi,

The second problem and I can't find out how to solve it - tapestry
rerenders always first component instance ActivityJournalItem. If with
loop we rendered 3 times, not depending what button was pressed always
exactly first zone is rerendered.

I didn't check your code google project, but I had a look to your code.

Every component has an unique tapestry id (t:id). When you loop like this :

     <div t:type="Loop" t:source="activities" t:value="activity">
       <t:ActivityJournalItem activity="activity"
cacheContainer="
>
> cacheContainer" />
>       </div>


where the code inside t:ActivityJournalItem is

 <t:zone t:id="activityAjaxZone" update="show">
...
</t:zone>

You are injecting the component with t:id="ActivityJournalItem" in your
loop. So three times the same component.





2010/8/10 Tornn <sergey.v.karpus...@gmail.com>

> Hi All! You are my last hope. I tried to resolve it by myself, I asked
> (http://tinyurl.com/2btkmzk) at stackoverflow.com but with no success
> yet.
>
>  A little background. I'm very interested in tapestry (and currently
> considering using it in production) because it looks like very
> efficient (in all senses) framework. And it looks like
> component-oriented framework. So I'm trying to work with it in a
> component way.
>
>  I'll try to fully describe problem.
>
>  I have page with loop of components, where every component have its
> own loop and other component in it. Inner component has form in it.
> Every component is enclosed in zone, because we want responsive UI and
> going to refresh only some portions of the page.
>  Within page I have following code:
>  <div t:type="Loop" t:source="journalDays" t:value="journalDay">
>    <t:DayJournalItem day="journalDay" cacheContainer="cacheContainer" />
>  </div>
>
>  By the way, page activated in some context (conversation-id).
>
>  Component DayJournalItem has following code:
>  <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
>  <t:zone t:id="dayAjaxZone" update="show">
>    <div class="dayHeader">${dayHeader}</div>
>    <div class="dayBody">
>      <div t:type="Loop" t:source="activities" t:value="activity">
>        <t:ActivityJournalItem activity="activity"
> cacheContainer="cacheContainer" />
>       </div>
>    </div>
>  </t:zone>
>  </div>
>
>  And component ActivityJournalItem has this code (I wiped out form
> fields and markup, as it's not important now. I think):
>  <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
>  <t:zone t:id="activityAjaxZone" update="show">
>    <t:if test="${editingActivity}">
>        <div class="activityEditFormBody">
>        <form t:type="form" t:id="activityForm" t:zone="activityAjaxZone">
>           ....
>          <input t:id="Save" t:type="Submit" value="Save" />
>          <input t:id="Cancel" t:type="Submit" value="Cancel" />
>        </form>
>        </div>
>    </t:if>
>    <t:if test="${!editingActivity}">
>        <div>viewing activity: ${activity.id}</div>
>    </t:if>
>  </t:zone></div>
>
>  The first problem is that tapestry cant automatically restore state
> of ActivityJournalItem component. When I receive event onSuccess for
> the form - fields of custom types are null. I solved this problem with
> pretty dirty work-around (I'm passing token with t:context and
> restoring state from custom cache object. I'm receiving token with
> onSuccess(String token)). So this problem can be considered solved,
> but i think that there may be some better solution. More native for
> tapestry. Like t:encoder when we using loop inside forms.)
>
>  The second problem and I can't find out how to solve it - tapestry
> rerenders always first component instance ActivityJournalItem. If with
> loop we rendered 3 times, not depending what button was pressed always
> exactly first zone is rerendered. Screenshoot:
> http://my.jetscreenshot.com/2672/20100808-thdx-190kb.jpg
>
>  So my question is: How to solve second problem and maybe there is
> better solution for the first problem.
>
>  I have a very little understanding on how tapestry internally works,
> and I think there is something wrong with ids. Every zone in rendered
> html has its own unique ID, but I cant see it when injecting zone with
> "@Component Zone activityAjaxZone;". The clientId is null - maybe this
> is the problem. And if I specify not only t:id but also id like
> 'id="activityAjaxZone${someCustomToken}"  ' it will result in other
> problem - buttons do nothing - I can press it all day but no errors,
> no actions - nothing.
>   I tried to debug, but there are many code injected in my class at
> real-time, so I can't debug it.
>
>  p.s. By the way - my test project is open-source and you can look at
> full source code at google code:
> http://code.google.com/p/tasks-journal/source/checkout
>
> --
> Best regards,
>  Karpushin Sergey.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to