-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I have in ZUL file an H2 tag
<h2 id="titleTextH2"></h2>
but I want to update from java side it's content, in order to have this result:
<h2 id="titleTextH2">RAW TEXT</h2>
If I append a Label component, the result is:
<h2 id="titleTextH2"><span class="...">RAW TEXT</span></h2>
but I want to avoid extra <span> tags.... how can I do it from Java side?
thanks!
The h2 component doesn't have setLabel or setValue methods, but you can dynamically modify the contents like this:
H2 titleText = ... // wire this component somehow in Java code titleText.getChildren().clear(); titleText.appendChild(new Text("NEW TEXT"));
Hmm, interesting, I had no idea ZK wraps all free text in z-text spans.
I don't see any easy or clean way out of this, because span wrapping is defined in the ZHTML language definition.
One way is to implement a custom H2 tag by extending ContentTag:
public class CustomH2 extends ContentTag { public CustomH2() { super("h2"); } }
Asked: 2012-10-24 20:24:21 +0800
Seen: 175 times
Last updated: Oct 26 '12