【发布时间】:2021-12-08 17:11:08
【问题描述】:
关于这个例子http://tabulator.info/docs/5.0/format#icon
在单元格点击功能中,如何更改格式化程序中使用的图标?
用例只是在单击单元格时将文件夹图标更改为文件夹打开。
【问题讨论】:
标签: tabulator
关于这个例子http://tabulator.info/docs/5.0/format#icon
在单元格点击功能中,如何更改格式化程序中使用的图标?
用例只是在单击单元格时将文件夹图标更改为文件夹打开。
【问题讨论】:
标签: tabulator
相当简单,在 rowData 中跟踪状态...
https://jsfiddle.net/hgwz4knp/
cellClick:function(e, cell){
let row = cell.getRow();
let data = row.getData();
row.update({openClosed:data.openClosed ^ 1});
this.redraw(true);
},
formatter:function(cell, fP, onR){
let data = cell.getRow().getData();
if (data.openClosed == 1) return "<i class='fas fa-folder-open'></i>";
return "<i class='fas fa-folder'></i>";
},
【讨论】:
this.redraw() 在 5.0.4 中不存在。