'How to return values from data.custom to Select formio (typescript)?
An error occured within custom function for country ReferenceError: getAddressResource is not defined from the code below. I don't know what I'm doing wrong?.
export default class Component extends (ParentCompoenent as any){
addResource = [];
getAddressResource() {
return async function a(){
try{
const Provider = Formio.Providers.getProvider('storage', this.component.storage);
if (Provider) {
const provider = new Provider(this);
let test = await provider.getResources();
return test;
}
} catch(e){
}
}
}
static schema (...extend){
return ParentCompoenent.schema({
label: DISPLAY,
type: ID,
key: ID,
clearOnHide: true,
tableView: true,
persistent: true,
autoAdjust: true,
hideLabel: true,
storage: 'resources',
columns: [
{ components: [ {
label:'Country',
key: 'country',
type: 'select',
input: true,
dataSrc: 'custom',
validate: {
required: true
},
data: {
custom:'getAddressResource()'
}
}], width: 4, offset: 0, push: 0, pull: 0, size: 'md' },
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
