AjaxLink and component visibility

2009-11-15 Thread Ed _

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=restaurantsform=MFESRPpubl=WLHMTAGcrea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

Re: AjaxLink and component visibility

2009-11-15 Thread bgooren

Hi,

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,
use 
http://wicket.apache.org/docs/1.4/org/apache/wicket/Component.html#setOutputMarkupPlaceholderTag(boolean)
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.

Bas


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=restaurantsform=MFESRPpubl=WLHMTAGcrea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1
 

-- 
View this message in context: 
http://old.nabble.com/AjaxLink-and-component-visibility-tp26365175p26365902.html
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