var people = [{
key: 'John Smith',
value: 'Name is john smith'
},
{
key: 'Andrew Smith',
value: 'Name is andrew smith'
}
]
var tableData = [{
name: "Oli",
nameIs: "Name is Oli Bob"
}]
var table = new Tabulator("#example-table", {
height: '100%',
layout: "fitColumns",
data: tableData,
columns: [{
title: "Name",
field: "name",
editor: 'autocomplete',
editorParams: {
showListOnEmpty: true,
freetext: true,
allowEmpty: true,
searchFunc: (term, values) => {
const matches = []
people.forEach(person => {
const name = person.key
const nameIs = person.value
if (name.toLowerCase().startsWith(term.toLowerCase())) {
matches.push(name)
}
})
return matches
},
values: false
}
},
{
title: "Name Is",
field: "nameIs"
}
]
})
table.on("cellEdited", (cell) => {
const name = cell.getValue()
const row = cell.getRow()
const nameIs = people.filter(p => p.key == name)[0].value
row.update({
"nameIs": nameIs
})
})
<link href="https://unpkg.com/tabulator-tables/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/tabulator-tables/dist/js/tabulator.min.js"></script>
<div id="example-table"></div>