1

What is the best way to override the html in a label

asked 2015-10-08 11:35:53 +0800

bobtedbob gravatar image bobtedbob
17 3

Hi

I have a label which has text in, on the server I want to pass the text to this label via a renderer but I also want to make certain parts of the text bold / different font color etc. Is this possible?

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2015-10-08 14:08:11 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

updated 2015-10-08 14:08:37 +0800

Hey Bobtedbob,

There is no way to set different style within 1 label.

There are 3 solutions what you can do.

First solution:

As Darksu already mentioned, you can use a hlayout where you put children attribute for the children and so dynamicly construct different labels with there styles.

Second solution :

Use ckeditor in stead of label. ckeditor is a textbox who supports html(and create html output when you type). The problem here is it's not a label.

Thirth solution:

Use htmlNativeComponent.
This is possible when your text in controller or viewmodel is already html style with the colors.

Example use :

Hlayout parent; // this must be wired in controller or use @selectorParam in viewmodel 
HtmlNativeComponent n = new HtmlNativeComponent("html", myString, "");
parent.getChildren().clear();
parent.appendChild(n);

Greetz chill.

link publish delete flag offensive edit
0

answered 2015-10-08 12:16:39 +0800

Darksu gravatar image Darksu
1991 1 4

Hello bobtedbob,

Until now i have not found a direct way to solve your issue, but as an alternative you could use multiple labels inside a hbox (each label with it's own style).

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2015-10-08 14:58:06 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

You can use a html component to enclose the html content.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-10-08 11:35:53 +0800

Seen: 43 times

Last updated: Oct 08 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More