Question

SmartGWT will set the css class for some FormItem by default value if we don't set the class explicitly. For example, a TextItem will look like this:

<input ... class="textItem" ...>

There is a method in SmartGWT which sets a css class for some FormItem explicitly:

textItem.setTextBoxStyle("foo");

BUT this method removes all previous css classes including the default class. Is there a way not to remove but to append (or insert) some custom class to the FormItem? I want to get the following result:

<input ... class="textItem foo" ...> or

SmartGWT will be changing the last css class during the user interaction according to the fired events. So I would insert my custom class before the default class in order to keep the FormItem looking the same:

<input ... class="foo textItem" ...>
<input ... class="foo textItemFocused" ...>
<input ... class="foo textItemDisabled" ...> ect.

Is it possible to do so?

Was it helpful?

Solution

I never used SmartGWT, so perhaps this is not the best solution.

You can use getTextBoxStyle (Javadoc) to get the class string and then you add this to your own class and set it back again.

You only need to "save" your css class, if you intend to remove the class later on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top