如果满足条件,我想在标题单元格中添加一个图标。我知道在文档中它提到动态占位符是一件事,但它没有详细说明如何添加你自己的。
我试过的:
定义我自己的模板:
templates: {
headerCell: '<th data-column-id="{{ctx.column.id}}">{{ctx.column.text}}{{ctx.column.myCustomIcon}}</th>',
}
然后在格式化程序中,添加自定义字段。
formatters: {
myCustomField: function(column, row){
column.myCustomIcon = "";
if (item[column.id] == 0) {
return "";
}
column.myCustomIcon = '<i class="fa fa-shield"></i>';
}
}
没用,请多指教。