Setting background color in Extjs text box

I am trying to set the background color in a text box when its value is greater than 75. Therefore, I added the code below to the listener

listeners: {
       beforeRender: function(e) {
           if (someValue >= 75) {
               e.style = " background-color: #00CC99";
           }
       }
 }

but I get something like below when it displays,

enter image description here

Is there a way to make green color visible throughout the text box, and not just buttom? I realized that it doesn't display as intended, due to the default CSS background image. But I want to change css to change the value and not write separate CSS for only one text field. Is there any way to do this?

+5
source share
1 answer

Just get rid of the background image:

e.style = "background-image:none;background-color:#00cc99;";
/* or */
e.style = "background:none #00cc99;";

If it eis a DOM object, use element.style.property = 'value':

e.style.backgroundImage = 'none';
e.style.backgroundColor = '#00cc99';
/* or */
e.style.background = 'none #00cc99';

ExtJS ( ExtJS " " demo):

.x-form-field,.x-form-text{
    /* ... */
    background:url("../../resources/themes/images/default/form/text-bg.gif") 
         repeat-x scroll 0pt 0pt white;
}
+6

All Articles