//Table with recordsetvar
<td data-label="EDIT AND DELETE">
<lightning:buttonMenu alternativeText="More options" onselect="{!c.editDeleteJS}" iconSize="small" aura:id="{!grpsegrel.Id}">
<lightning:menuItem label="Edit" value="editGrp" iconName="utility:edit" />
<lightning:menuItem label="Delete" value="deleteGrp"iconName="utility:delete" />
</lightning:buttonMenu>
</td>
//JSController Method
editDeleteJS: function(component, event, helper) {
var menuValue = event.detail.menuItem.get("v.value");
switch(menuValue) {
case "editGrp": helper.doEdit(); break;
case "deleteGrp": helper.doDelete(); break;
}
}
//Helper
doEdit: function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
var a = editRecordEvent.getSource();
var idb = a.getLocalId();
alert(idb);
editRecordEvent.setParams({
//"recordId": event.target.id
"recordId": idb
});
editRecordEvent.fire();
}
From helper I am trying to capture that id, but either event.target or .getsource() are not returning the id any idea what i am doing wrong?
Best Answer
Added Class in the the button menu and in controller retrieved using this line of code:
var tempid = event.getSource().get("v.class");