1

how can I get the row I clicked from table ?

so that I can recover the data I want. the click is working

  <aura:iteration items="{!v.data}" var="row">
                <tr class="slds-hint-parent" onclick="{!c.showRow }" >
                    <td data-label="OpportunityNumber__c" >
                        <div class="slds-truncate" title="{!row.OpportunityNumber__c}">{!row.OpportunityNumber__c}</div>
                    </td>
                    <td data-label="Date" > 
                        <div class="slds-truncate" title="{!row.CreatedDate}">{!row.CreatedDate}</div>
                    </td>
                    <td data-label="Nom Affaire" >  
                        <div class="slds-truncate" title="{!row.Name}">{!row.Name}</div>
                    </td>

                </tr>
            </aura:iteration>

constorller js

showRow:function(component,event,helper){
  console.log("it's work");
}   
0

Try this:

<tr class="slds-hint-parent" data-myid="some data" onclick="{!c.showRow }" >

Then in JS:

showRow:function(component,event,helper){
  console.log("it's work ", event.currentTarget.dataset.myid);
}
3
  • i try like this myid="{!row.OpportunityNumber__c}" then in js event.currentTarget.myid . I get undefined Jul 23 '19 at 14:36
  • its event.currentTarget.dataset.myid Jul 23 '19 at 14:38
  • it's work thank you Jul 23 '19 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.