+ Start a Discussion

Refresh ONE Lightning Component on a Page

I have a page that contains two lightning components. One is a calendar, the other is a list view. 

On the calendar lightning component, a user will click, a hidden modal will be displayed so the user can create a record. Upon save success, I want *just the calendar component* to refresh. Not the entire page. 

I've tried using $A.get('e.force:refreshView').fire(); on the callback in the calendar component. The result is both components refreshing. Same result when I create and fire a refresh event in the calendar component. 

I can't seem to find much documentation in regards to refreshing single components on a page. Any ideas?

Maharajan CMaharajan C
Hi Ahardy,

Please try to create and fire your own event, and handle it in the same components that needs to be refreshed.

1. As per the document you can use the Component Event.

               -->  Create the Component Event. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_create.htm
               ---> Register the Event in Calender Component and Fire the Event in save success.  https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_fire.htm
               ---> Use the new handler in Calender Component to call the doInit function again.  https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_handling_intro.htm

2. If the Component Event is not working go for the Application Event:



Hi Maharajan, 


I actually tried this the first time, (and re-tried again). 

While it is firing the doInit function again after save, it isn't doing any reloading the component at all. (checked by tossing in a console.log and ensuring it showed after record save).