Newer Version Available

This content describes an older version of this product. View Latest

force:refreshView

Reloads the view.

To refresh a view, run $A.get("e.force:refreshView").fire();, which reloads all data for the view.

This example refreshes the view after an action is successfully completed.

1refresh : function(component, event, helper) {
2    var action = cmp.get('c.myController');
3    action.setCallback(cmp,
4        function(response) {
5            var state = response.getState();
6            if (state === 'SUCCESS'){
7                $A.get('e.force:refreshView').fire();
8            } else {
9                 //do something
10            }
11        }
12    );
13    $A.enqueueAction(action);
14}

This event is handled by the one.app container. It’s supported in Lightning Experience and Salesforce1 only. If used outside of Lightning Experience or Salesforce1, this event won’t be handled automatically. To use this event outside of one.app, create and wire up an event handler of your own.

Note