Hi Markus!
Thank you for your response!
I tried to do that. But if I add id="something${counter}" where
counter is just a number it stops working at all.
It renders ok. But buttons do nothing - they cannot submit the form.
If I generate ${counter} as it Tapestry does ({"", "_0", "_1", ....,
"_n"}), that I have the same behavior as earlier - it rerenders only
the first "instance" of control at the page.
I tried to use only "id". And "id" and "t:id". Result is the same.
With simple counter as a number it stops working, with tapestry-like
counter it rerenders only the first "instance".
p.s. When I say "first instance" I mean "first render" of component
(Katia, thanks for comments).
2010/8/11 Markus Feindler <[email protected]>:
> Each zone in a loop must have a unique id, so you have to create an id for
> example like this:
>
> ${zoneId}
>
> private int idcounter;
>
> public String getZoneId() {
> return "randomtext" + idcounter++;
> }
>
> Otherwise only the first zone will be updated. Use id instead of t:id for
> zones.
>>
>> 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
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Best Regards,
Sergey
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]