I have a requirement where I am creating table row dynamically. I have to call javascript controller method from dynamically created ui:inputText using change="{!c.calculateCostAndPrice}" attribute. I need the current row Index from where method is being invoked. I have used aura-id to get the index but it works only for single row because, for multiple rows, aura-id will not be unique.
Component code-
<aura:iteration items="{!v.PhaseLineItemWrapper}" var="item" indexVar="index">
<table class="slds-table slds-table--bordered slds-accordian-sec" role="grid">
<tr class="slds-hint-parent" id ="{!index}">
<td scope="row">
<ui:inputText placeholder="Quantity" value="{!item.QuantityOfItem}" class="slds-input" change="{!c.calculateCostAndPrice}" >
</td>
</tr>
</table>
Controller method-
calculateCostAndPrice : function(component,event,helper){
var resultCmp = component.find("thisInput").get("v.value");
console.log("resultCmp:::"+resultCmp);}
event.currentTarget.parentNode.parentNode.id
to get the Id from tr element?