I'm trying to use the below example to add a value to combobox dynamically, but I'm running into errors.
Option to select none in picklist fields lightning-combobox - LWC
<lightning-combobox
value={PicklistValues }
options={PicklistValues }
placeholder="Select an Option"
label="Name"
onchange={handleChange}>
</lightning-combobox>
@track PicklistValues;
@wire(getPicklistValues, {
recordTypeId: '$objectInfo.data.defaultRecordTypeId',
fieldApiName : ACCOUNT_FIELD})
getpicklistValues(result) {
if (result.data) {
this.PicklistValues = [ { label: 'None', value: 'None', selected: true }, ...result.data.values ];
} else if (result.error) {
console.log(result.error);
}
}
I'm running into an error
Uncaught (in promise) TypeError: Cannot set property 'aChildren' of undefined
Can someone suggest me what am I doing wrong?
aChildren
comming from?PicklistValues
andpicklistValues
are not the same thing. You can't usepicklistValues
for both options andvalue
.