tabulator - 更改图标/按钮列的格式
问题描述
关于这里的这个例子http://tabulator.info/docs/5.0/format#icon
在单元格单击功能中,如何更改格式化程序中使用的图标?
用例只是在单击单元格时将文件夹图标更改为文件夹打开。
解决方案
相当简单,在 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>";
},
推荐阅读
- pandas - 无法从 Pandas DF 中检索数据,无法替换 Pandas DF 中的列中的值
- random - 我可以在 2 个 Npcs 上使用 self.math.random 吗?
- c# - EF Core 异步选择 InvalidOperationException
- javascript - Laravel/Slick:未捕获的 TypeError:$(...).slick 不是函数
- python - 如何为电子邮件内容格式化我的 HTML 文本 (smtplib)
- cloud - 是否有任何安全问题或不发布 Web 应用程序中使用的代码的理由
- python-3.x - 如何在 django_requestlogging 中获取用户名
- c - 如何从整数表示的日期中获取年龄
- r - 如何在 R 中使用 sf 操作 shapefile 多边形的几何形状
- discord - 如何在将特定角色分配给例如 20 人时自动锁定频道