I have parent and child components. I have reasons to keep child component as separate. I am trying to get the selected record information when I click any of the buttons(child component). Not sure what could be equivalent to event.target.parentNode.
Parent Component
<aura:iteration items="{!v.SECompanies}" var="company">
<tr>
<td> ***calling child component*****
<c:Actions aura:id="actionCmp"/>
</td>
<td>{!company.companyId}</td>
<td>{!company.companyName}</td>
<td>{!company.ultimateParentName}</td>
<td>{!company.street1}</td>
<td>{!company.address}</td>
</tr>
</aura:iteration>
Child Component
<aura:component description="Actions">
<aura:attribute name="seCompanyID" type="String"/>
<aura:attribute name="seCompanyName" type="String"/>
<div class="slds-media__figure">
<button class="slds-button slds-button--icon" aria-haspopup="true">
<lightning:icon iconName="action:new_opportunity" class="slds-is-open" size="xx-small" title="Create new Opportunity" /> |
</button>
<button class="slds-button slds-button--icon" aria-haspopup="true" onclick="{!c.createSEComp}">
<lightning:icon aura:id="editSEComp" iconName="action:edit" class="slds-is-open" size="xx-small" title="Edit SECompany"/>
</button>
</div>
</aura:component>
Child controller
({
createSEComp : function(component, event, helper){
var temp1 = event.target.data; //how to get the selected record information here?
console.log("component find is" +temp1);
}
})
company
variable. Then, just send thecompany
variable related to the child component from your parent. Finally, access your attribute in yourcreateSEComp
method using for example :var companyId = component.get("v.company").companyId;