1

When selecting the list of option from available options in (lightning:dualListbox) and move/push them to the selected options box or list. The entire component (lightning:recordEditForm) gets refreshed. Not sure stop the refresh of parent component and do a custom handle function to save the selected option values inside the lightning:recordEditForm

Component

<aura:component controller="aacountIntialization" implements="force:appHostable,force:hasRecordId,force:hasSObjectName,flexipage:availableForRecordHome,lightning:actionOverride,force:lightningQuickAction" access="global" >
    <!-- Attributes -->
   <aura:attribute name="value" type="String" />
   <aura:attribute name="arraySelected" type="String[]" />
   <aura:attribute name="listOptions" type="List" default="[]"/>
   <lightning:recordEditForm aura:id="editscreen" recordId="{!v.recordId}" objectApiName="Account">
      <lightning:button class="slds-m-top_small" variant="neutral" label="Save" iconPosition="right" type="submit"/>
      <lightning:dualListbox aura:id="multipleselectOptions" name="MultiSelectOptions" label="States" 
                       sourceLabel="Available Options" 
                       selectedLabel="Selected Options" 
                       options="{! v.listOptions }"
                       value="{! v.arraySelected }" onchange="{! c.handleChange }"/>
   </lightning:recordEditForm>
</aura:component>

Controller

handleChange : function (component, event, helper) {
   var selectedOptionValue = event.getParam("value");
   helper.arrayToMultistring(selectedOptionValue);
}

Helper

arrayToMultistring: function(selectedOptionValue){
    var array = selectedOptionValue;
    var str = "";
    if(array.length>0){
        for(var i in array){
            console.log(array[i]);
            str=str+array[i]+";";
        }
    }
    component.set("v.arraySelected",str);
}
8
  • How’s your helper function implemented?
    – Jayant Das
    Commented May 1, 2018 at 2:51
  • @JayantDas updated my question with helper component Commented May 1, 2018 at 2:53
  • What exactly you mean when you say entire component is refreshed? You don’t have any other attribute except for the duallist and the button. What’s the behavior, can you clarify a bit?
    – Jayant Das
    Commented May 1, 2018 at 2:56
  • lightning:recordEditForm has few more tags like lightning:inputField, where i am directly saving all those fields on lightning:button type="submit". But when i have a lightning:dualListbox the entire recordeditform gets refresh when you move the selected options from left box to right Commented May 1, 2018 at 2:59
  • Your code does not seem to be complete. You don't have a reference of component in your helper, whereas you are still using it there. Are you sure this is your complete code? Using dualListBox does not refresh the component, you must have something which is causing this refresh.
    – Jayant Das
    Commented May 1, 2018 at 3:16

1 Answer 1

0

This issue is fixed with summer'18 Release of Salesforce.Salesforce issue reported here

1
  • If you could link to any release notes that would greatly improve this answer.
    – Adrian Larson
    Commented Jun 6, 2018 at 14:29

You must log in to answer this question.

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