您可以使用自定义formatter函数将任何HTML放入单元格中.您的列定义可能如下所示:
var myColumnSet = [
{
key: 'active_employee',
label: 'Active',
formatter: function(el, oRecord, oColumn, oData) {
// el is the HTMLElement of the current cell
// oRecord gives you access to other fields from the
// DataSource, e.g.: oRecord.getData('full_name')
// oData is the value of the current field (active_employee)
if (oData) {
el.innerHTML = '<img src="/images/active.png">';
} else {
el.innerHTML = '<img src="/images/not-active.png">';
}
}
},
// other Columns....
];
Run Code Online (Sandbox Code Playgroud)
另请参阅自定义单元格格式示例.