I want to populate Multiselect field with list of values dynamically. Instead of assigning the values to Array of string in aura attribute, I'm referring to the object from controller directly, But my multiselect field is not populating values. Since this is dynamic field, I can't assign values to list in aura:attribute and refer it. Please guide.
Component:
<aura:iteration items="{!v.myMetadata}" var="md" indexVar="index">
<aura:if isTrue="{!(md.datatype == 'multi')}">
<lightning:dualListbox aura:id="selectGenre"
name="Genre"
label="{!md.label}"
sourceLabel="Available Genre"
selectedLabel="Selected Genre"
options="{!md.values}"
/>
</aura:if>
</aura:iteration>
Helper:
var records =response.getReturnValue();
records.forEach(function(record) {
var mdValues = [];
//Values__c is a comma seperated text field from object, example A,B,C
if(record.Values__c){
nameArr = record.Values__c.split(',');
for (var i = 0; i < nameArr.length; i++) {
mdValues.push(nameArr[i]);
}
}
//mdValues is list of string that has A,B,C Values
mData.push({
label : record.Field_Label__c,
datatype : record.Datatype__c,
section : record.Section__c,
values : mdValues
});
console.log('mData:');
console.dir(mData);
});
var defValues = response.getReturnValue();
component.set("v.myMetadata",mData);