我试图在其值大于75时将背景颜色设置为文本字段.所以我将以下代码添加到监听器
listeners: {
beforeRender: function(e) {
if (someValue >= 75) {
e.style = " background-color: #00CC99";
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是当它呈现时我得到类似下面的东西,

有没有办法让绿色在整个文本框中可见而不仅仅是buttom?我发现由于默认的CSS背景图像,它没有按预期显示.但我想改变价值变化的CSS而不是只为一个文本框写单独的CSS.有办法吗?
摆脱背景图片:
e.style = "background-image:none;background-color:#00cc99;";
/* or */
e.style = "background:none #00cc99;";
Run Code Online (Sandbox Code Playgroud)
如果e是DOM对象使用element.style.property = 'value':
e.style.backgroundImage = 'none';
e.style.backgroundColor = '#00cc99';
/* or */
e.style.background = 'none #00cc99';
Run Code Online (Sandbox Code Playgroud)
为了完整性,ExtJS中的定义(根据ExtJS"表单字段类型"演示):
.x-form-field,.x-form-text{
/* ... */
background:url("../../resources/themes/images/default/form/text-bg.gif")
repeat-x scroll 0pt 0pt white;
}
Run Code Online (Sandbox Code Playgroud)