Thabks for d'acces :)

Anyway, I'm happy to know tyou solved your problem, even if i dnd't help a
lot in the end .)

good luck with your tapestry project

2010/8/12 Josh Canfield <joshcanfi...@gmail.com>

> > Thank you very much!!! This is great.
> >  Now it works!
> Great!
>
> > I'm sorry for badly written question
>
> No worries, I'm just lazy and don't want to have to think too hard ;)
>
> -- Josh
>
> On Aug 12, 2010, at 3:51 AM, Tornn <sergey.v.karpus...@gmail.com> wrote:
>
> > Hi Josh!
> >
> >  Thank you very much!!! This is great.
> >  Now it works!
> >
> >  I'm not sure if this is last issue on my way, but this current issue
> > is solved. Thank you again.
> >
> >  p.s. I'm sorry for badly written question. I will try harder to
> > write good questions, which will save community time.
> >
> > 2010/8/12 Josh Canfield <joshcanfi...@gmail.com>:
> >> Hi Karpushin Sergey.
> >>
> >>>    <t:if test="${editingActivity}">
> >> Don't use ${} notation within bound parameters. This can cause
> >> problems in other situations (casts the value to a string).
> >>
> >>>  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.
> >>
> >> What you put in your form elements is significant so you need to show
> >> at least one of the fields that are set to null. If you use accessors
> >> like value="activity.name" then you are telling tapestry to use a
> >> property conduit and it will try to set that value when the form is
> >> submitted. If you are using value="${activity.name}" then you are
> >> passing a string to Tapestry and it will not try to update it during
> >> submit.
> >>
> >>>  The second problem and I can't find out how to solve it - tapestry
> >>> rerenders always first component instance ActivityJournalItem.
> >>
> >> As was previously mentioned you are binding to a single zone id
> >> "activityAjaxZone" which exists only once on the page for the first
> >> item rendered with that component id. You need each of your forms and
> >> zones to use a specific unique zoneId.  The zone ids generated need to
> >> be unique to the page so you don't update the wrong zone. You can
> >> figure out a naming scheme.
> >>
> >> Here is a simple example:
> >>
> >> <t:loop t:source="1..5" t:index="loopIndex">
> >> <!-- the zone's t:id is used to identify the single instance of the
> >> component that lives within the page so that we can return it's body
> >> during the update event handler -->
> >>    <t:zone t:id="notUsedForDOMId"
> id="myPageUniqueZoneIdPrefix_${loopIndex}">
> >>        Hello! Click
> >>        <t:eventlink event="update"
> >> zone="myPageUniqueZoneIdPrefix_${loopIndex}">${now}</t:eventlink>
> >>    </t:zone>
> >> </t:loop>
> >>
> >> // support class property/methods
> >>
> >>    @Property
> >>    private int _loopIndex;
> >>
> >>    public Block onUpdate() {
> >>        return ((Zone)
> >> _resources.getEmbeddedComponent("notUsedForDOMId")).getBody();
> >>    }
> >>
> >>    public String getNow() {
> >>        return new Date().toString();
> >>    }
> >>
> >> Please consider that when you submit questions you need to break the
> >> problem down to the simplest elements. When you cut and paste
> >> incomplete or large portions of code with extraneous elements then it
> >> generates extra work for those who would like to help. I think you'll
> >> find that if you spend the time to simplify the problem you'll not
> >> only have a higher chance of solving it yourself (things jump out when
> >> you remove all the cruft) but you'll also get better help from
> >> whatever community you are asking for help.
> >>
> >> Here is your code broken down into the bare essentials, same problems
> >> but much more approachable for a fresh set of eyes:
> >>
> >> <div t:type="Loop" t:source="journalDays" t:value="journalDay">
> >>    <t:zone t:id="dayAjaxZone" update="show">
> >>        <div t:type="Loop" t:source="activities" t:value="activity">
> >>            <t:zone t:id="activityAjaxZone" update="show">
> >>                <div>
> >>                    <form t:type="form" t:id="activityForm"
> >> t:zone="activityAjaxZone">
> >>                        <!-- Fields omitted for brevity (but since
> >> they are part of your problem should probably have been included-->
> >>                        <input t:id="Save" t:type="Submit" value="Save"/>
> >>                        <input t:id="Cancel" t:type="Submit"
> value="Cancel"/>
> >>                    </form>
> >>                </div>
> >>            </t:zone>
> >>        </div>
> >>    </t:zone>
> >> </div>
> >>
> >>
> >> Good luck!
> >>
> >> Josh
> >>
> >> On Tue, Aug 10, 2010 at 2:07 PM, Tornn <sergey.v.karpus...@gmail.com>
> wrote:
> >>> 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
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> --
> >> http://www.bodylabgym.com - a private, by appointment only, one-on-one
> >> health and fitness facility.
> >> --
> >> http://www.ectransition.com - Quality Electronic Cigarettes at a
> >> reasonable price!
> >> --
> >> TheDailyTube.com. Sign up and get the best new videos on the internet
> >> delivered fresh to your inbox.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > С Уважением,
> >  Карпушин Сергей
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to