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?

4
  • 1
    where is aChildren comming from?
    – glls
    Commented Feb 3, 2020 at 23:45
  • PicklistValues and picklistValues are not the same thing. You can't use picklistValues for both options and value.
    – zaitsman
    Commented Feb 3, 2020 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
    Commented Feb 4, 2020 at 2:38
  • It seems to happening when I'm dispatching a event from the connectedcallback
    – cartman
    Commented Feb 6, 2020 at 21:13

1 Answer 1

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

1
  • I have updated my question, I still face the same issue.
    – cartman
    Commented Feb 4, 2020 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .