如何在datatable的单元格中显示图像而不是布尔值?datatable与数据源相关联。
发布于 2009-08-05 14:37:21
您可以使用自定义的formatter
函数将任何超文本标记语言放入您的单元格中。列定义可能如下所示:
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....
];
https://stackoverflow.com/questions/1226372
复制