Tuesday, May 20, 2008

Wicket components not being created when visible = false

Came across an interesting one today... if you have a component in Wicket with visible=false when the page is rendered the first time, the markup for that component is not sent to the browser at all. The end result is that you cannot use Ajax to make the component visible at a later stage. Turns out there is an easy way around this though, just call setOutputMarkupPlaceHolderTag(true) on the component, and a placeholder tag is sent ot the browser, which can later be replaced with Ajax.

1 comment:

Anonymous said...

Thanks for posting about that, It finally solved my issue : I was trying to make a dropdown visible or invisible when I was changing the selection of another dropdown and without setOutputMarkupPlaceholderTag(true);
My dropdown was correctly rendered invisible but then didn't come back from the invisible world.
Thanks a lot