Good Day
I have a field visible in the editor to change how a featured is rendered, but the field itself is a string value. Is it possible / how do It pass, codedValues in the editor config, so the input is a drop down?
if (event.added.length > 0) {
this._editWidgetConfiguration = [];
this._view.map.layers.forEach((layer) => {
this._editWidgetConfiguration.push({
layer: layer,
formTemplate: {
elements: [{
type: "field",
fieldName: "layer",
label: "blah",
codedValues: [
{name: "1", code: "1"},
{name: "2", code: "2"},
]
}]
}
})
});
console.log('Edit Widget Configuration');
console.log(_.cloneDeep(this._editWidgetConfiguration));
this.editorWidget.layerInfos = this._editWidgetConfiguration;
}
That code is ran when layers are added to the map. I have the list of available settings available at this point, because I've built the unqiue render settings, so how do I pass the coded values to the editor?
The field is defined as:
{
name: 'layer',
alias: 'layer',
type: 'string'
},
Thanks
Solved! Go to Solution.
Figured out the problem, you have to tell the setting it's a coded-value domain, the following code works:
this._editWidgetConfiguration.push({
layer: layer,
formTemplate: {
elements: [{
type: "field",
fieldName: "layer",
label: "blah",
domain: {
codedValues: [
{name: "1", code: "1"},
{name: "2", code: "2"},
],
type: 'coded-value'
}
}]
}
})
Hopefully this helps someone else 🙂
Thanks
Figured out the problem, you have to tell the setting it's a coded-value domain, the following code works:
this._editWidgetConfiguration.push({
layer: layer,
formTemplate: {
elements: [{
type: "field",
fieldName: "layer",
label: "blah",
domain: {
codedValues: [
{name: "1", code: "1"},
{name: "2", code: "2"},
],
type: 'coded-value'
}
}]
}
})
Hopefully this helps someone else 🙂
Thanks