Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

Update Zone Outside of AjaxFormLoop

Mark W. Shead

2010-08-29

Replies: Find Java Web Hosting

Author LoginPost Reply
I have a situation similar to the phone book entry shown here:
http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/AjaxFormLoop.html

However, I need to be able to display a count of items in the
AjaxFormLoop and have it update when items are added or removed from
the loop. So using the phonebook example, I need to display a count of
the phone numbers that are currently shown on the page. The count
value needs to only be displayed once (not after every telephone
number)

Mark, so I think that will require placing it outside of the
AjaxFormLoop. Is there anyway to trigger the update to another zone
from within this method:

@CommitAfter
Object onAddRowFromPhones()
{
  Phone phone = new Phone();

  person.getPhones().add(phone);
  phone.setPerson(person);

  return phone;
}


I looked at the multizone updates discussed here:
http://tapestry.apache.org/tapestry5.2-dev/guide/ajax.html

But I don't see a way to combine this with the onAddRowFromPhone
method. I unsuccessfully tried something along the lines of:

@CommitAfter
Object onAddRowFromPhones()
{
  Phone phone = new Phone();

  person.getPhones().add(phone);
  phone.setPerson(person);

  return new MultiZoneUpdate("phones",
phonesForm).add("phoneCountZone", phoneCountZone);

}

But since onAddRowFromPhones normally returns the object that needs to
be added, I'm pretty sure this shouldn't work with a multizone update.

So my questions are:

1. Is there a simple way to update another zone in addition to the
loop when an onAddRow method is called?
2. Is there a simple way to display the count within the AjaxFormLoop
where it will be updated each time an item is added or removed?
3. Is there some better approach that will give me similar results
that I'm overlooking.

Any suggestions?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.