I have a dropdown in a table in a lightning component. Here is the code of that td.
<tbody>
<aura:iteration items="{!v.recipientList}" var="recipient">
<tr class="slds-hint-parent"
id="{!recipient.rowCount}">
<td>
<lightning:select aura:id="{!'recCo-'+recipient.rowCount}" onchange="{!c.changedRecipContact}">
<option selected="selected" value="None">-None-</option>
<aura:iteration items="{!v.consList}" var="cons">
<option value="{!cons.id}" selected="{!(recipient.contact.Id == cons.id)}">{!cons.name}</option>
</aura:iteration>
</lightning:select>
</td>
.
..
<!--Other td inputs-->
</tr>
</aura:iteration></tbody>
Once a contact is selected, I am trying to get the aura:id using lines below
var a = event.getSource(); var selectId = a.getLocalId();
But I am getting {!'recCo-'+recipient.rowCount}, not the dynamic value. Please advice how to get the ID and < option > value in the controller. If there is any other way of getting this id like using datasets or something like that and then the option value from it, please let me know.
I have been using < select > since a lot of years but it is broken in Chrome browser so I am trying to get this done by lightning:select. Here is the link to that issue.