【发布时间】:2022-01-06 14:30:33
【问题描述】:
我的制表器定义中需要有两个自动完成。用户将选择一名员工 - 首先是自动完成 - 然后当他选择合同时 - 第二列,自动完成必须链接到第一列中选择的值。
据我所知Tabulator 没有这样的功能。所以我在想,在单击“合同”单元格时,列定义 - 自动完成定义 - 将被更新。我无法让它工作,因为函数updateDefinition 是buggy。它创建新列而不是更新其定义。
工作jsFiddle
table.on("cellEditing", function(cell){
//e - the click event object
//cell - cell component
updateTitle(cell)
})
table.on("cellClick", function(e, cell){
updateTitle(cell)
})
function updateTitle(cell){
var field = cell.getField()
if (field == "contract" || field =="id"){
var column = cell.getColumn()
var name = cell.getRow().getData().name
console.log(field)
console.log(name)
column.updateDefinition({title:"Updated Title"})
}
}
我正在使用 MaterializeCSS 及其autocomplete,但我不知道如何使用它inside Tabulator。如果这真的是个好主意。
您能否提出最佳解决方案?
【问题讨论】:
标签: javascript autocomplete tabulator