The answer to your question is simple: component replacement over ajax needs
to be able to "find" the old component so it can be replaced with new
content. Since you set panel B to be invisible, it simply is not in the
page, and therefore cannot be replaced.

Simple solution: if you want to replace an invisible component through AJAX,
Component#setOutputMarkupPlaceholderTag . This will output an HTML tag which
can be replaced by an AJAX call.

Ofcourse you should also call setOutputMarkupId(true) so wicket generates an
id with which it can locate the placeholder.


Ed_ wrote:
> Trying to build a shopping cart - Panel B . Which is hidden till an item
> is selected. Items are stored in the session.
> I am trying to get  (shipping cart )Panel B to show up when I click an
> Ajax link, viz in Panel C
> Both the Panels are under a parent panel A.
> When I fist get to the page Panel B is hidden - I am using
> B.setVisibility(false).
> When I click the link in Panel C. I am construction a new PanelB and call
> a method in panelA to replace the oldB with the newB
> method on PanelA.updateShopping cart(){
>  oldB.replaceWith(newB)
> newB.setVisibility(true);
> }
> I can't get B to show up unless I do a page reload. 
> Once B is on the page though clicking the links in Panel C - keeps
> updating it just fine.
> Ideas on what I am messing up in getting the shopping cart to show up for
> the first item to be added, I want to avoid a page reload when the first
> item is added and stick with the ajax behavoir.
> thx!
> _________________________________________________________________
> Bing brings you maps, menus, and reviews organized in one place.
> http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

View this message in context: 
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Reply via email to