【发布时间】:2019-07-05 02:17:43
【问题描述】:
我确信有一个简单的解决方案可以解决这个问题,我已经浏览了 Tabulator 文档和常见问题解答,但我无法解决。编辑单元格时,我需要该行中的另一个单元格以特定值进行更新。 JS Fiddle 中提供的当前测试代码:https://jsfiddle.net/f35p7gyx/。
{id:1, name:"Oli Bob"},
{id:2, name:"Mary May"},
{id:3, name:"Christine Lobowski",},
{id:4, name:"Brendon Philips"},
{id:5, name:"Margret Marmajuke"},
{id:6, name:"Frank Harbours"},
];
new Tabulator("#example-table", {
data: tabledata,
columns: [
{title:"ID", field:"id", editor:"input"},
{title:"Name", field:"name", editor:"input"},
{title:"EDN", field:"EDN", sorter:"string", width:100, headerFilter:"input", tooltip:"Orange = not cleared and Green = Cleared",
cellClick:function(e, cell, formatterParams){
var e = document.getElementById("myselect");
var colour = e.options[e.selectedIndex].value;
if (colour == ""){
// do nothing
} else {
cell.getElement().style.backgroundColor = colour;
console.log({...cell.getRow().getData(), colourKey: colour});
}
}
}
],
});
如果我编辑姓名字段,我需要用“已编辑”填充 EDN 字段。
Tabulator 库在这里http://tabulator.info
【问题讨论】: