我正在尝试根据我的数据库表中的字段值更改记录背景颜色,但是我没有成功。知道什么可以阻止这种变化吗? 我的数据库中的字段名称是 STATUS。
grid = new Ext.grid.GridPanel({
region:'center',
store: gridStore,
cm: colModel,
stripeRows: true,
sm: _selctionModel,
bbar:paging,
viewConfig:
{
forceFit: true,
headersDisabled:false,
stripeRows: false,
getRowClass: function(record) {
return record.get('STATUS') == 'OP' ? 'child-row' : 'adult-row';
}
},
CSS:
.child-row .x-grid-cell-inner{
background-color:red;
color:red;
}
.adult-row .x-grid-cell-inner{
background-color:blue;
color:blue;
}
请注意放置:
.x-grid-cell-inner{
background-color:blue;
color:blue;
}
会改变背景颜色。
最佳答案
您是否尝试过在网格面板上使用渲染? 在这种情况下,您也可以尝试使用 tpl。 状态值可用于呈现函数以返回行的不同值。设置样式属性应该可以解决您的问题。
关于javascript - 根据数据库值更改记录的颜色,extjs4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35056930/