0

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?

  • 1
    where is aChildren comming from? – glls Feb 3 at 23:45
  • PicklistValues and picklistValues are not the same thing. You can't use picklistValues for both options and value. – zaitsman Feb 3 at 23:48
  • @glls it is some where in the aura.js file Uncaught (in promise) TypeError: Cannot set property 'aChildren' of undefined at En (aura_prod.js:4) at Object.update (aura_prod.js:4) at dn (aura_prod.js:4) at fn (aura_prod.js:4) at aura_prod.js:4 at Ir (aura_prod.js:4) at kn (aura_prod.js:4) at Object.update (aura_prod.js:4) at dn (aura_prod.js:4) at fn (aura_prod.js:4) – cartman Feb 4 at 2:38
  • It seems to happening when I'm dispatching a event from the connectedcallback – cartman Feb 6 at 21:13
1
<lightning-combobox
        value={picklistValues}
        options={picklistValues}
        placeholder="Select an Option"
        label="Name"
        onchange={handleChange}>
</lightning-combobox>

value={picklistValues}

options={picklistValues}

have equals {picklistValues}. value - need to be "None" for example

|improve this answer|||||
  • I have updated my question, I still face the same issue. – cartman Feb 4 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.