You need to sign in to do that
Don't have an account?
m 10
how to write controller for refresh component
how ot write below component contoller and helpr for lighting button in component please help me
<button class="slds-button slds-button_neutral" >
<lightning:icon class="slds-button__icon slds-button__icon_left" iconName="utility:refresh" size="x-small" alternativeText="Refresh" />
Refresh
</button>
<button class="slds-button slds-button_neutral" >
<lightning:icon class="slds-button__icon slds-button__icon_left" iconName="utility:refresh" size="x-small" alternativeText="Refresh" />
Refresh
</button>
Please find below sample code to refresh a lightning component.
<aura:component controller="editRecordSimulationController"
implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:dependency resource="markup://force:editRecord" type="EVENT" />
<aura:handler event="force:refreshView" action="{!c.doInit}" />
<aura:attribute name="recordId" type="string" />
<aura:attribute name="accType" type="String" />
<aura:attribute name="accObj" type="account" default="{ sObjectType: 'Account'}"/>
<ui:inputText label="Record Id" value="{!v.recordId}" required="true"/>
<ui:button class="btn" label="Submit" press="{!c.setOutput}"/>
<br />
<br />
<br />
Account Type: <ui:outputText value="{!v.accObj.Type}" />
</aura:component>
Controller:
========
({
doInit : function(component, event, helper) {
var recordId = component.get("v.recordId");
var action = component.get("c.getTypeFromAccount");
action.setParams({
recordId: recordId
});
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
var acc = response.getReturnValue();
component.set("v.accType", acc.Type);
component.set("v.accObj", acc)
}
});
$A.enqueueAction(action);
},
setOutput : function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": component.get("v.recordId")
});
editRecordEvent.fire();
}
})
Hope this should help you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks,
Vinay Kumar