I’m lost, where is the problem.
I have external source for editor “list”, but I have authorization in headers, so I can’t use built in functionality for external ajax requests.
My values model:
[
{ id: 1, name: 'USA' },
{ id: 2, name: 'Canada' },
]
Definition:
{ field: "country", title: "Country", editor:"list", editorParams: codeListEditor("country"), formatter: "codelist" },
EditorParams:
const codeListEditor = (name: string) => {
return {
values: getCodeListEditor(name),
clearable: true,
maxWidth: true,
freetext: false,
allowEmpty: true,
listOnEmpty: true,
filterDelay: 100,
autocomplete: true,
multiselect: true,
filterFunc: (term) => getCodeListEditor(name, term),
itemFormatter: (label, value, item) => {
return item.name;
}
}
}
Everything works fine, but after select I have undefined value in model.
tabulator.on('cellEdited', () => {
console.log(cell.getRow().getData()); // Here I have selected value undefined.
});
It’s a problem because it’s object? How can I say what I want set to the model? My codelist formatter do only return value.name, but in formatter is value undefined too.
Formatter:
Tabulator.extendModule("format", "formatters", {
codelist: (cell) => {
return cell.getValue()?.name;
}
});