You need to sign in to do that
Don't have an account?
Nethra Raghupathy
Navigate from one page to another on button click in both Lightning and Classic
Hi,
I want to navigate from one page to another on a button click. It should work for both Lightning and classic.
button.cmp: lightning component
ButtonController.apxc : Apex controller
I want to navigate from one page to another on a button click. It should work for both Lightning and classic.
button.cmp: lightning component
<lightning:button label="View Interview" value="{!row.oppId+'@'+indx}" iconPosition="left" disabled="{!row.interviewFlag}" onclick="{!c.displayInterview}"/>buttonController.js: lightning controller
displayInterview : function (component, event, helper) { /*var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url": "/apex/home" }); urlEvent.fire();*/ var action = component.get("c.displayInterviewApex"); action.setCallback(this, function(data) { console.log(data.getReturnValue()); }); }Commented part works for lightning but not in classic.
ButtonController.apxc : Apex controller
public class ButtonController { public static pagereference displayInterviewApex(){ system.debug('called'); Pagereference redirectedPage = New PageReference('/apex/home'); return redirectedPage; } }displayInterviewApex function is not called as its not aura enabled. If I add @AuraEnabled, pagereference is not supported. Is there a way to do for both classic and lightning?