You need to sign in to do that
Don't have an account?
Eric Blaxton 11
Add Spinner to lightning component
Hi and thanks in advance for any help.
I created a lightning component (Quick action). How do I add a spinner while the code is doing it's job?
Regards,
Eric
I created a lightning component (Quick action). How do I add a spinner while the code is doing it's job?
Component <aura:component controller="sendtoBrandQA" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes" > <aura:attribute name="cse" type="Case"/> <!--old way of passing to Controller and runs without interaction from user --> <!--<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> --> <!--shows/waits for outlined button to be pressed: "Send Brand QA email" --> <lightning:button variant="brand-outline" label="Send Brand QA Email" onclick="{!c.doInit}" /> </aura:component>
Controller: ({ doInit : function(component, event, helper) { //Get Current user var userId = $A.get("$SObjectType.CurrentUser.Id"); console.log("### userId = "+userId); var action = component.get("c.escalateCase"); action.setParams({ "objectId": component.get("v.recordId"), "userId" : userId }); action.setCallback(this, function(response){ var state = response.getState(); console.log("#### state = "+state); if(component.isValid() && state === "SUCCESS"){ console.log("Hello 1"); console.log("### response.getReturnValue() = "+JSON.stringify(response.getReturnValue())); var str = response.getReturnValue(); console.log("#### str = "+ str); if(str == 'Item has been escalated!'){ console.log("#### success = "+str); helper.toastMessage(str, 'success'); $A.get("e.force:closeQuickAction").fire(); }else{ console.log("#### error = "+str); helper.toastMessage(str, 'error'); $A.get("e.force:closeQuickAction").fire(); } } }); $A.enqueueAction(action); } })
Helper: ({ toastMessage : function(msg, type) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams ({ title : 'Brand QA Information', message: msg, duration:' 15000', key: 'info_alt', type: type, mode: 'dismissable' }); toastEvent.fire(); } })
Regards,
Eric
Component:
Controller:
css:
All Answers
https://developer.salesforce.com/docs/component-library/bundle/lightning:spinner
https://www.lightningdesignsystem.com/components/spinners/
Component:
Controller:
css: