ExtJS的4 - 如何背景颜色添加到一个网格的列? [英] ExtJS 4 - How to add background colors to columns of a grid?
问题描述
我有一个的电网的中,我需要提供不同的背景颜色的不同列。
I have a grid in which I need to provide different background colors to various columns.
这列颜色应该也不会被鼠标悬停
颜色被覆盖。
These column colors should also not be overwritten by the mouse-over
color.
我一直在使用 CLS尝试,但没有运气。
I have tried using cls
and tdCls
but no luck.
可以在如何可以实现任何人引导?
Could anyone guide at how this could be achieved?
先谢谢了。
推荐答案
NetEmp就在这里,你想渲染器和要使用直接'风格'的方法或我做到了下面使用以下内容:
NetEmp is right here, you want a renderer and you want to use the direct 'style' method or I did it below using the following:
function greyRenderer(lpValue, opMeta, opData)
{
if (opData.data["Condition"] == 0) {
opMeta.attr = "style='color: #aaa';";
}
lpValue = Ext.util.Format.htmlEncode(lpValue);
return lpValue;
}
请注意这里我检查该行的值在某一特定领域,然后将颜色应用到前景文本和HTML EN code输出,可以很明显的只是切换的事情您的具体要求。
Note here I check the value on the row in a particular field and then apply the colour to the foreground text and html encode the output, you can obviously just switch things to your specific requirements.
这篇关于ExtJS的4 - 如何背景颜色添加到一个网格的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!