Jav T
Jav T

Reputation: 478

Hiding a <div> tag using wicket & eclipse

I've tried to hide a tag in wicket, I've managed to accomplish that only in the case that follows:

HTML
...
<div wicket:id="div_id">This is what hides</div>


JAVA
final WebMarkupContainer wmc = new WebMarkupContainer("div_id");

Method
public onSubmit(){
      wmc.setVisible(false);
}

This manages to get the div hidden, but my div tag has another wicket components inside, and so I can't seem to get this working, error pops saying inner components are not defined in the component "div_id".

Any idea how to get this working?

Thanks guys!!

Upvotes: 3

Views: 5984

Answers (2)

Gorky
Gorky

Reputation: 1413

If you have other components inside that div, you have to add your other components to the markup container you have for the div instead of adding them to your page. What wicket is looking for is a match between the hierarchy on the Java and HTML part.

Upvotes: 3

Nicktar
Nicktar

Reputation: 5575

This is just a very wild guess, since I don't know how you add the inner components and what exactly fails, but if you add or modify them in onBeforeRender() and you're using Wicket 1.4.x, you'll need to override WebmarkupContainer.callOnBeforeRenderIfNotVisible() to return true...

For Wicket 1.5 this code should be moved to onConfigure()

Upvotes: 0

Related Questions