You need to sign in to do that
Don't have an account?
Hm_invi
get the id and field values from aura iteration table?
Hi, i have created a aura table with case fields in it.
no i want to find the id and and values of the row when i click on the case number.
iam able to find the id using "event.currentTarget.dataset.recordid" but not the field values.
how can i also get the field values as they are already in the instance.
i made a server call to apex but it is only happening after firing the event.
how to solve this?
no i want to find the id and and values of the row when i click on the case number.
iam able to find the id using "event.currentTarget.dataset.recordid" but not the field values.
how can i also get the field values as they are already in the instance.
i made a server call to apex but it is only happening after firing the event.
how to solve this?
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="1" > <thead> <tr> <th>Case Number</th> <th>Subject</th> <th>Created Date</th> </tr> </thead> <tbody> <aura:iteration items="{!v.filterlstCases}" var="cas"> <tr > <td onclick="{!c.handleRowAction}" data-recordid="{!cas.Id}"> <a>{!cas.CaseNumber}</a> </td> <td onclick="{!c.handleRowAction}" data-recordid="{!cas.Id}"> <a>{!cas.Subject}</a> </td> <td> <lightning:formattedDateTime value="{!cas.CreatedDate}" year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit" hour12="false"/> </td> </tr> </aura:iteration> </tbody> </table>
handleRowAction : function(component, event, helper){ var selectedItem = event.currentTarget; var recordId = selectedItem.dataset.recordid; //call to apex var getCaseAction = component.get("c.fetchCaseDetails"); getCaseAction.setParams({ 'fetchId': recordId }); getCaseAction.setCallback(this, function(response){ var actionState = response.getState(); if(actionState == 'SUCCESS') { console.log(response.getReturnValue()); } }); $A.enqueueAction(getCaseAction); //event call var evt = $A.get("e.c:myCasesDetailsEvent"); evt.setParams({ "caseIdfromChild" : recordId }); evt.fire(); }
public class portalCases { @AuraEnabled public static list<Case> fetchCaseDetails(string fetchId) { list<case> detailList = [SELECT CaseNumber, Subject, CreatedDate, Status,origin FROM Case WHERE id= :fetchId]; system.debug(detailList); return detailList; } }
might be helpful to someone.
Try this
Component changes
js
All Answers
might be helpful to someone.
Try this
Component changes
js
What is the data type of var record