You need to sign in to do that
Don't have an account?
David Webb 26
Lightning datatable refresh
Is there a way to refresh the data in a lightning datatable after making an update via an apex class?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Here's the html for my component which is just a lightning-datatable that lists out opportunties. What I was trying to accomplish was select one or more rows and then update each selected record with an apex method. Following the update, I wanted to refresh the datatable. This code does that.
HTML
JS
GetAllOpportunities.cls
UpdateOpportunities.cls
All Answers
Greetings to you!
You can use force:refreshView to request a page refresh. Try like this:
And don't forget to add below handler in your component:
Or you can call init method in handler action: <aura:handler event="force:refreshView" action="{!c.doInit}" />
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Apex:
Component:
Controller:
CSS:
I hope it helps 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. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Here's the html for my component which is just a lightning-datatable that lists out opportunties. What I was trying to accomplish was select one or more rows and then update each selected record with an apex method. Following the update, I wanted to refresh the datatable. This code does that.
HTML
JS
GetAllOpportunities.cls
UpdateOpportunities.cls
After geting response from apex controller you have to call doInit method again inside that method in which you call apex controller.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi