function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Narendra Reddy GopavaramNarendra Reddy Gopavaram 

Not displaying drop down values inside aura iteration?

Hi All,

I am not able to get drop down values inside aura iteration when onchange method calls.
Wrapper Object attribute:
<aura:attribute name="mapobject" type="object" access="global"/>

Aura Iteration Part:
<table class="slds-table slds-table_bordered slds-table_cell-buffer" width="100%">
    <thead>
    <tr class="slds-text-title_caps">
    <th scope="col" width="15%" class="cbcolor">
    <div class="slds-truncate" title="Brand" style="color:black"><center>Brand</center></div>
    </th>
    <th scope="col" width="20%" class="cbcolor">
    <div class="slds-truncate" title="Product Description" style="color:black"><center>Product Description</center></div>
    </th>
    </tr>
    </thead>
    <tbody> 
    <aura:iteration items="{!v.mapobject}" var="mobj" indexVar="indx">
    <tr>
    <td width="15%">
    <div class="slds-form-element slds-input-custom">
    <span>
    <lightning:select aura:id="selprod" name="{!indx+1}" value="{!mobj.selectedprod}" class="text_size" onchange="{!c.getmapmeth}">
    <option  text="--None--" label="--None--" />
    <aura:iteration items="{!v.brandlst}" var="pdesc">
    <option  text="{!pdesc}" label="{!pdesc}" />
    </aura:iteration>
    </lightning:select><br/>
    </span>
    </div>
    </td>
    <td width="20%">
    <div class="slds-form-element">
    <span>
    <lightning:select value="{!mobj.selectedproddesc}" class="text_size">
    <option text="--None--" label="--None--" />
    <aura:iteration items="{!mobj.proddesclist}" var="pdesc">
    <option text="{!pdesc}" label="{!pdesc}" />
    </aura:iteration>
    </lightning:select><br/>
    </span>
    </div>
    </td>
    </tr>
    </aura:iteration>
    </tbody>
    </table>

Helper method:
var prbwrp = component.get("v.mapobject");
        for(var n=0;n<prbwrp.length;n++)
        {
            if(index == n)
            {
                for(var k=0;k<helpervalues.length;k++)
                {
                    prbwrp[n].proddesclist.push(helpervalues[k].proddesc);
                }
                alert('Index #: '+index+' = List Values: '+prbwrp[n].proddesclist);
            }
        }

Wrapper Class:
public class productdetailwrap
    {
        @AuraEnabled public String brandlist{set;get;}
        @AuraEnabled public String proddesc{set;get;}
        @AuraEnabled public list<String> proddesclist{set;get;}
        public productdetailwrap()
        {
            proddesclist=new list<String>();
        }
    }
I am seleting brand, based on selected brand i need to petch prod desc values. Values are getting js controller, but not displaying in cmp. Can anybody help me to resolve this issue.

Thanks in advance!
AnudeepAnudeep (Salesforce Developers) 
Can you try using value attribute in <option></option>? also, does it work fine when you hardcode the values? 

See example in this documentation
Narendra Reddy GopavaramNarendra Reddy Gopavaram
Thanks for you replay Anudeep .

I have already referenced given document. But in my situation it is not working. What attributes i have used for selected value and options, those attributes using from server side controller wrapper class. I am pushing returned values to list<string>, this list is from wrapper class, these values showing in js controller, but not showing in cmp.

From given document if i use "cmp.find("select").set("v.value", "closed");", i am getting error "component.find(...).set is not a function".

Thanks.