You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by HHB <hu...@yahoo.ca> on 2008/12/14 10:09:45 UTC

How to update base page panel from child page?

Hey,
I use inheritance to do layout.
The base page containing main section that should contains child's markup,
and  cart section.
Child pages are supposed to perform operations that will update the cart
section (lets say via Ajax).
My question is how to ask the cart section to updates its state (and redraw
it) from a child page?
I'm new to Wicket so forgive my questions :)
Thanks for your time.
-- 
View this message in context: http://www.nabble.com/How-to-update-base-page-panel-from-child-page--tp20998486p20998486.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


RE: How to update base page panel from child page?

Posted by Mikko Pukki <Mi...@syncrontech.com>.
Hi,

If you have a WebmarkupContainer (or whatever grouping component) that holds all
components of your cart, you can put a public/protected method updateCart(AjaxRequestTarget target)
on your base page. When you click on AjaxLink on child page, you can
call that method. Same applies for any other ajax callback method that gets AjaxRequestTarget
(for example in AjaxButton, AjaxSelfUpdatingBehavior etc...)

for example:

onClick(final AjaxRequestTarget target){
	// do your stuff in here
	updateCart(target)
}

in your updateCart method you then do:

protected void updateCart(AjaxrequestTarget target){
	target.addComponent(cart);
}

- Mikko

-----Original Message-----
From: HHB [mailto:hubaghdadi@yahoo.ca] 
Sent: 14. joulukuuta 2008 11:10
To: users@wicket.apache.org
Subject: How to update base page panel from child page?


Hey,
I use inheritance to do layout.
The base page containing main section that should contains child's markup,
and  cart section.
Child pages are supposed to perform operations that will update the cart
section (lets say via Ajax).
My question is how to ask the cart section to updates its state (and redraw
it) from a child page?
I'm new to Wicket so forgive my questions :)
Thanks for your time.
-- 
View this message in context: http://www.nabble.com/How-to-update-base-page-panel-from-child-page--tp20998486p20998486.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


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


SV: How to update base page panel from child page?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> My question is how to ask the cart section to updates its 
> state (and redraw it) from a child page?

Just add the superclass element to the AjaxRequetTarget parameter. This
means either holding a reference to it (e.g. a protected instance field)
or better, use get("path:to:cart") to get at it. Remember that all
elements that should be updated via Ajax needs to have called
setOutputMarkupId(true) on them so that the Javascript libraries can
adddress them.

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