I have a lightning card placed on a component and it has a lightning button menu , the first button is view where on clicking it, it needs to open a record detail page in a seperate tab, The record id of that record is in a string variable. I used navigatetosobject in side of onselect for lightning button menu but it is not working, can someone tell me how to acheive this.
This is the html for the button menu :
<div class="slds-dropdown_right">
<lightning:buttonMenu alternativeText="Toggle menu" menuAlignment="right" class="slds-m-left_xx-large" onselect="{!c.handleMenuSelect}">
<lightning:menuItem label="View" value="view"/>
<lightning:menuItem label="Completed-Payment" value="completedPayment"/>
<lightning:menuItem label="Uncollectible" value="uncollectible"/>
<lightning:menuItem label="Already Paid" value="alreadyPaid"/>
</lightning:buttonMenu>
</div>
This is the function in helper :
navToDelDetails: function (component, event, helper){
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId":"v.delRecordId"});
navEvt.fire();
This is the controller where i called the helper inside onselect :
handleMenuSelect: function(component, event, helper) {
var selectedMenu = event.detail.menuItem.get("v.value");
console.log('selectedMenu-' + selectedMenu);
switch(selectedMenu) {
case "view":
helper.navToDelDetails(component,delRecordId);
break;
case "uncollectible":
//do delete
break;
case "alreadyPaid":
//do edit
break;
}
}