I have a table that I'm generating using aura:iteration
. And the code is as below.
<aura:attribute name="icon" type="String" default="utility:down"/>
<aura:iteration items="{!v.careerData}" var="note">
<tr>
<td data-id="{!note.id}" >
<div class="slds-truncate clist1" data-id="{!note.id}" >
{!note.noteText}
</div>
<div> <lightning:buttonIcon iconName="{!v.icon}" variant="bare" onclick="{! c.handleClick }" alternativeText="Settings" title="Settings" /></div>
</td>
<td>{!note.contactedByType}</td>
</tr>
</aura:iteration>
here In my handleClick
, I want to toggle the icon of only the clicked buttonIcon
when I'm trying to use the below js
, it is toggling all the icons.
handleClick: function(c,e){
c.set("v.icon", c.get("v.icon")=="utility:down"? "utility:up":"utility:down");
}
Please let me know where am I going wrong and how can I fix this.
Thanks