Panel setVisible() in Ajax call
Hi all, I have a Page with a DropDown Component and a Panel. The Panel displays some stuff based on the model object of the DropDown. In the constructor of my page, I set panel.setVisible(false) to prevent the panel from being rendered while the model object of the DropDown is null because the user has not yet selected an option. Now I want the Panel to be rendered once a valid choice is selected by the user. I tried this: protected void onEvent(AjaxRequestTarget target) { log.debug(ddMonth onChange triggered.); if(month != null) { reportPanel.setVisible(true); reportPanel.updatePanel(getServiceManager(), getUser(), month); target.addComponent(reportPanel); } } The event is triggered, the panel is not rendered though. Is there a way to achieve this without reloading the entire page? If not, how would I trigger a page reload from the onEvent method? Thanks, Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Panel setVisible() in Ajax call
if you set the panel to be invisible on first render, you also have to call panel.setOutputMarkupPlaceholderTag(true) so that a hidden placeholder is rendered, which gets replaced with the real panel once you set it to visible and add it to the ajaxrequestarget. Gerolf On Fri, Mar 21, 2008 at 10:54 AM, Stephan Koch [EMAIL PROTECTED] wrote: Hi all, I have a Page with a DropDown Component and a Panel. The Panel displays some stuff based on the model object of the DropDown. In the constructor of my page, I set panel.setVisible(false) to prevent the panel from being rendered while the model object of the DropDown is null because the user has not yet selected an option. Now I want the Panel to be rendered once a valid choice is selected by the user. I tried this: protected void onEvent(AjaxRequestTarget target) { log.debug(ddMonth onChange triggered.); if(month != null) { reportPanel.setVisible(true); reportPanel.updatePanel(getServiceManager(), getUser(), month); target.addComponent(reportPanel); } } The event is triggered, the panel is not rendered though. Is there a way to achieve this without reloading the entire page? If not, how would I trigger a page reload from the onEvent method? Thanks, Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Panel setVisible() in Ajax call
On Fri, 21 Mar 2008, Gerolf Seitz wrote: if you set the panel to be invisible on first render, you also have to call panel.setOutputMarkupPlaceholderTag(true) so that a hidden placeholder is rendered, which gets replaced with the real panel once you set it to visible and add it to the ajaxrequestarget. ...and when this is the case, you should see an error about it on the Ajax debug console (Wicket javascript complaining about how it cannot find the specified element in HTML. Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]