extjs 根据值更改网格单元格背景 [英] extjs change grid cell background based on value
本文介绍了extjs 根据值更改网格单元格背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将渲染器应用于我的网格列,但背景颜色没有改变:
I applied a renderer to my grid-column, but the background color is not changing:
renderer: function(value, meta) {
if (parseInt(value) > 0) {
meta.tdCls = 'category-matching'; return value;
}
else {
meta.tdCls = 'category-not-matching'; return value;
}
}
CSS:
.x-grid-cell .category-matching {
background-color:green;
}
.x-grid-cell .category-not-matching {
background-color:red;
}
我也试过
.grid-cell-inner
和
background-color:red; !important
但没有效果.
有什么想法吗?
推荐答案
试试这个...
renderer : function(value, meta) {
if(parseInt(value) > 0) {
meta.style = "background-color:green;";
} else {
meta.style = "background-color:red;";
}
return value;
}
它对我有用.
这篇关于extjs 根据值更改网格单元格背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文