Thanks for your suggestion. It sounds like I'm not overlooking
anything obvious. :)  Redrawing the entire loop works with some
issues. I figured if it was capable of redrawing the entire loop then
I should be able to get access to what I need to redraw only certain
parts of it.

The problem I'm having with redrawing the whole loop is that now my
text field is part of what is being redrawn and this is introducing
two other issues:

1. All text fields update, which isn't desirable because it highlights
the entire table instead of just what changed. (My end goal was to
only update the zones that had changed.)

2. It also isn't ideal with a long list.

3. The text field loses focus after the first keyup so it is
impossible for anyone other than Superman to type more than one digit
before the text field loses focus.

I can live with items 1 and 2, but the prospects of only letting
Superman use this application are slim. So #3 is probably the big
issue.

I can't seem to tell the zone update to return focus to the last
updated field.  I'm using the javascript described here:
http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)

And I've tried adding:
this.element.focus();
To the last line of updateZone : function() but it doesn't seem to do
anything.  I AM able to set the focus to a field that is outside of
the updated zone, so my guess is that the zone update is somehow
making it lose focus.

Any ideas?

Mark


On Tue, Jan 11, 2011 at 1:35 PM, Josh Canfield <joshcanfi...@gmail.com> wrote:

> You have a single zone component and when doing a multi-zone update
> you want to simulate a loop to get different content rendered for that
> zone. I'm not sure there is a way to do this easily. It's definitely a
> reasonable use case.
>
> If your change is modifying all the prices, could you just re-draw the
> whole table with an outer zone?
>
> Josh
>
>
> On Tue, Jan 11, 2011 at 9:35 AM, Mark <mark-li...@xeric.net> wrote:
>> I have a form with a loop that looks something like this:
>>
>> |__QTY__|_ITEM__|__PRICE__|
>> |__1_____|_soup__|____$1____|
>> |__3_____|_peas__|____$3____|
>> etc.
>>
>> Users can change the quantity and it automatically changes the price.
>> Each price is in its own zone and the KeyUp action on the
>> cooresponding QTY causes that price zone to update. (I'm using the
>> zoneUpdater described at
>> http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)
>>
>> Now the requirements have changed and we need to be able to offer a
>> discount based on the number of items being purchased.  This means
>> that an update to the soup row will sometimes need to change not only
>> the price soup row, but also the peas row. At first I tried building a
>> MultiZoneUpdate (Thank you for your help Josh), but that just sets
>> every price to the same thing as the row that is being updated. This
>> is because the context of the row/event that triggered the updated
>> doesn't provide the context for the zones that need to be updated. If
>> I change the Qty of soup to 2, the soup item is the context for that
>> update, so when I update the row for peas, that zone doesn't know
>> anything about peas--only soup.
>>
>> So my question is:
>> How can I access an item from the context when the zone was rendered
>> instead of the context of the section that is triggering the zone
>> update.
>>
>> It seems like I could solve this if each zone was rendered with a
>> context that could be used when an update was triggered on that zone.
>> Something like:
>> <t:zone t:context="item" t:id="priceZone" id="priceZoneId">
>> ${itemSubtotal}</t:zone>
>>
>> The idea being, that when you update a zone, it can figure out the
>> context at which the zone was originally created and not just the
>> context of the event firing the update. (Of course I don't know how
>> this would work on the Java side of things.)
>>
>> Is there a way to do something like this?  Is there a different way to
>> do it that I've just overlooked and I'm making things harder than they
>> need to be?
>>
>> Mark

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

Reply via email to