You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Elin <po...@gmail.com> on 2010/08/18 12:10:29 UTC

Update zones after session object changes

Hi. Im new to tapestry and im trying to do some projects but its a bit hard
because of the lack of documentation.

Well im doing a simple shopping cart. The cart is stored into my session and
im developing some components for showing the data.  I made this with the
ajaxformloop component so im able to delete a product from the shopping cart
with an ajax request. Everything works fine but i want other zones to be
notified someway so they reload their content (they show the cart content
too) updated after changes.

So:

I have a component developed by myself that recieves the shopping cart
stored into my session as parameter.

<t:mycartview t:shoppingcart="shoppingcart"/>

This shows a list of my shopping cart products with delete buttons for each
one and works fine but i have more components into my page showing this cart
contents and i want them to be updated (or notified that something has
changed) once i delete one product from the cart. I could reload the page
too but didnt want to (that way using ajaxformloop would be stupid... i
would use page redirections).

Is it possible?

Thx in advance 
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Update-zones-after-session-object-changes-tp2639152p2639152.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Update zones after session object changes

Posted by Elin <po...@gmail.com>.
Thx a lot for your answers. Gonna experiment a bit with the information u
gave me. I will be back if i need help again. 

Thx a lot for your help 
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Update-zones-after-session-object-changes-tp2639152p2639567.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Update zones after session object changes

Posted by zozul <zo...@gmail.com>.

Elin wrote:
> 
> Well... i need some kind of event from my custom component that alerts the
> page where its inserted that something has changed (an item has been
> deleted fron the cart), so the page refreshes all the other components.
> 

I guess "ZoneUpdater" mixin is what you need 
http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html
http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html 
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Update-zones-after-session-object-changes-tp2639152p2639303.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Update zones after session object changes

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 18 Aug 2010 09:11:59 -0300, Elin <po...@gmail.com> wrote:

> I have my page. Inside my page i have a custom component that displays  
> the shopping cart items with a delete buton for each one.
> Well... i need some kind of event from my custom component that alerts  
> the page where its inserted that something has changed (an item has been  
> deleted fron the cart), so the page refreshes all the other components.

What about putting this components inside Zones and then using a  
MultiZoneUpdate? This will rerender them. That's what I would do.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Update zones after session object changes

Posted by Elin <po...@gmail.com>.
The problem is that i know how to multiupdate. Thats not the problem. The
problem is that i need some kind of event for that. 

I have my page. Inside my page i have a custom component that displays the
shopping cart items with a delete buton for each one.

Well... i need some kind of event from my custom component that alerts the
page where its inserted that something has changed (an item has been deleted
fron the cart), so the page refreshes all the other components.
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Update-zones-after-session-object-changes-tp2639152p2639269.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Update zones after session object changes

Posted by zozul <zo...@gmail.com>.
If i understand you correctly, you want to update few zones at one time, yes?
if so than you can do it by calling multizoneupdate

@Inject
private Zone zone1;

@Inject 
private Zone zone2;

Object onActionFromRegister()
  {
    return new MultiZoneUpdate("zone1", zone1).add("zone2", zone2);
  }

here you have example
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/ajaxmultizoneupdate
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/ajaxmultizoneupdate 

Hope it helps
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Update-zones-after-session-object-changes-tp2639152p2639180.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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