Newer Version Available
refreshNavigationItem() for Lightning Experience
Refreshes the selected navigation object's home page. Typically, standard and custom
objects open the object's list view. If split view is open, it's refreshed. This method
works only in Lightning console apps.
This method refreshes in the background. If the list view has unsaved changes, the method returns false and doesn’t refresh the navigation item. The method doesn’t set focus on the navigation tab.
The following navigation items aren’t supported:
- Custom Visualforce tabs
- Custom Aura component tabs
- Custom web tabs
- Dashboards
- Reports
Arguments
None
Sample Code
This Aura component has a button that, when pressed, refreshes the navigation item.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global">
2 <lightning:navigationItemAPI aura:id="navigationItemAPI"/>
3 <lightning:button label="Refresh navigation item" onclick="{!c.refreshNavigationItem}"/>
4</aura:component>Controller code:
1({
2 refreshNavigationItem : function(component, event, helper) {
3 var navigationItemAPI = component.find("navigationItemAPI");
4 navigationItemAPI.refreshNavigationItem().then(function(response) {
5 console.log(response);
6 })
7 .catch(function(error) {
8 console.log(error);
9 });
10 }
11})Response
This method returns a promise that, upon success, resolves to true. The promise is rejected on error.