-
12 Sep 2011 4:28 AM #1
Answered: TextField.setStyleName("pflichtFelder") has no effect
Answered: TextField.setStyleName("pflichtFelder") has no effect
Hey all
I have a problem with a TextField<String>.
I tried to change the background in my project css file, but I don't get it.
In my project.css is an entry ".pflichtFelder".
Then in my code ist TextField.setStyleName("pflichtFelder");
Wher is my mistake? I pray for help
-
Best Answer Posted by sven
This is not about GWT or GXT. This is about how CSS works.
Code:.pflichtFelder .x-form-text { background-color: yellow; background-image: none; }Code:textField.addStyleName("pflichtFelder");
-
12 Sep 2011 4:30 AM #2
You missed the most important information. What is the content of ".pflichtFelder"?In my project.css is an entry ".pflichtFelder".
You should use addStyleName in 99,99% of all cases.Then in my code ist TextField.setStyleName("pflichtFelder");
-
12 Sep 2011 4:31 AM #3
I always suggest to use Firebug or IE Developer Tools. These tools will tell you always exactly why your styling has no effect.
-
12 Sep 2011 4:53 AM #4
Thanks for the reply
I installed Firebug for Firefox 4 but I get no errors.
I changed the the Code to TextField.addStyleName("pflichtFelder");
But no change.
In my project.css in the following entry
I don't know why the background of the TextField isn't yellow.Code:.pflichtFelder { background-color: yellow; }
-
12 Sep 2011 4:57 AM #5
Why would you expect to get errors? With Firebug you can analyse what the correct rules would be.I installed Firebug for Firefox 4 but I get no errors.
In your case it would be something like
Please not that this is not related to GXT.Code:.pflichtFelder .x-form-text { background-color: yellow; }
There is a background image set too, which you probably want to remove.
-
12 Sep 2011 5:12 AM #6
-
12 Sep 2011 5:13 AM #7
-
12 Sep 2011 5:19 AM #8
Sorry I don't get it (Steh gerade aufm Schlauch)
In GWT the addStyleName-Method is to override the default-CSS-Style. You can use every name you like.
If you say background-color:yellow; the background was yellow.
In my GXT-application I have a LabelField with an other StyleName and there I have no problems.
Which default-css-Names I must override that I get after die Dialog is load a yellow background?
That is all I would like to get.
-
12 Sep 2011 5:23 AM #9
This is not about GWT or GXT. This is about how CSS works.
Code:.pflichtFelder .x-form-text { background-color: yellow; background-image: none; }Code:textField.addStyleName("pflichtFelder");
-
12 Sep 2011 5:27 AM #10
Oh, I'm really sorry. I have not good knowlage in CSS.
Thank for your help. Thank you very much.
I will learn more about CSS.


Reply With Quote