You need to sign in to do that
Don't have an account?
sru1209 n
refresh all related components in lwc on click of new button
Hi,
I need to refresh all related child components when i click new button.
So that data in all the tabs will be reset and set to blank.
Can someone pls help here!
How to write it in js file in handleclick(event)
Thanks!
I need to refresh all related child components when i click new button.
So that data in all the tabs will be reset and set to blank.
Can someone pls help here!
How to write it in js file in handleclick(event)
Thanks!
Key Highlights :
Refresh standard component
Works same like Aura Component
Code :
Here we will create a Lightning Web Component(LWC) in which we will delete the contact record. And then after we will refresh the full record page. We also create Apex class to delete the contact record and return the success notification in LWC.
RefreshStandardComponentCtrl.cls:
public class RefreshStandardComponentCtrl {
@AuraEnabled
public static string deleteContact(String recordId){
Contact con = [SELECT Id FROM Contact WHERE AccountId =:recordId LIMIT 1];
delete con;
return 'Record Delete successfully!!';
}
}
RefreshStandardComponent.HTML:
<template>
<!-- loader -->
<div if:true={isLoading}>
<lightning-spinner
alternative-text="Loading..." variant="brand" class="slds-is-fixed">
</lightning-spinner>
</div>
<!-- /loader -->
<!--------header----->
<div class="slds-tabs_card">
<div class="slds-page-header">
<div class="slds-page-header__row">
<div class="slds-page-header__col-title">
<div class="slds-media">
<div class="slds-media__figure">
<span class="slds-icon_container slds-icon-standard-opportunity">
<lightning-icon icon-name="standard:recipe" alternative-text="recipe" title="recipe"></lightning-icon>
</span>
</div>
<div class="slds-media__body">
<div class="slds-page-header__name">
<div class="slds-page-header__name-title">
<h1>
<span>Refresh Standard Components in LWC Salesforce</span>
<span class="slds-page-header__title slds-truncate" title="Recently Viewed">TechDicer</span>
</h1>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <br/>
<!--/header -->
<!-- Delete contact and refresh page -->
<lightning-card title="Refresh Standard Component" icon-name="custom:custom17">
<div class="slds-m-around_medium">
<lightning-button label="Delete Contact" onclick={handleClick} variant="brand"></lightning-button>
</div>
</lightning-card>
<!-- /Delete contact and refresh page -->
</template>
https://www.epayitonline.win/
Please follow below example:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh