Pergunta

My code:

myTextItem = new TextItem();
myTextItem.setHint("Some text");
myTextItem.setShowHintInField(true);
myTextItem.setHintStyle("myTextItemHint");

My css:

.myTextItemHint {
   color: gray;
}

My Problem:

My issue is that I can have that setShowHintInField(true) set OR my css getting applied, but not both.

I found more info about this on the link: http://forums.smartclient.com/showthread.php?t=14463 but I cannot come up with a common style / place for it, that would make the trick while the hint is inside the field.

My question:

What kind of css would I need in this case and how I tell the field to use it?

What I have tried:

With that setShowHintInField(true) line and without. Both cases: half of the solution is there. Not both halves.

Foi útil?

Solução

FormItem has method setCellStyle() to set the style of specific cell.

Use

myTextItem.setCellStyle("myTextItemHint");

your CSS will look like this:

.myTextItemHint, .myTextItemHint input {
    color: gray;
}

Override other properties also if needed

.textItem,.textItemFocused,.textItemDisabled,.textItemDisabledHint,.textItemError,.textItemHint

For more information on CSS, Please have a look at skin_styles.css that is already shipped along with standard skins in SmartGWT.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top