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?
-
fireToast , wait 2-3 secs then refresh?– Pranay JaiswalCommented 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– Return0Commented Jun 3, 2020 at 7:55
Add a comment
|
1 Answer
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);