1

I have a requirement that with the click of "Submit" button i need to call an apex method , if its a success i need to throw success toast message but along with that i need to refresh the component on UI front after toast message is thrown. For that i tried using eval("$A.get('e.force:refreshView').fire()") after toast message But in this case the component gets refreshed before the toast message gets thrown.Is it possible to delay component refresh so that toast message gets time to show up or is there any other way to refresh component?

2
  • fireToast , wait 2-3 secs then refresh? Jun 3, 2020 at 7:40
  • @Pranay Jaiswal not exactly waiting after toast its that i should get time to atleast throw toast...coz the component gets refreshed before even throwing toast
    – Return0
    Jun 3, 2020 at 7:55

1 Answer 1

0

Yes we can delay refresh of component or page using

//this will delay refresh of component by 4 secs    
setTimeout(function () { (eval("$A.get('e.force:refreshView').fire()")) }, 4000);

//this will delay refresh of page by 4 secs
setTimeout(function () { (window.location.reload()) }.bind(this), 4000);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.