【发布时间】:2014-10-13 12:22:00
【问题描述】:
基于单元格值,我想将 CSS 类应用于光滑网格中的该单元格。
我在列上使用以下代码
{
id: 'deptType',
name: 'Department Type',
field: 'dept_type',
sortable: true,
formatter: function ( row, cell, value, columnDef, dataContext ) {
if(value === 'red'){
return '<div style="width:100%; padding:0; margin:0" class ="red">' + value + '</div>';
}
return '<div style="width:100%; padding:0; margin:0" class ="green">' + value + '</div>';
}
}
虽然这段代码有效。我想知道是否有更好的方法来解决这个问题?
【问题讨论】: