I have one lightning component named "Add/Edit Invoice Line Item" (as seen on screenshot) I want to reload this component every time a user clicks on this tab. Is there any way or event which can be used to handle this?
2 Answers
lightning:tab by default will load only 1st time when it gets focus - there-by rendering the content/component in its body. Even when you navigate away from that tab, the content will just be hidden but not unrendered.
Workaround: aura:if will render/unrender content in it depending on the condition. So use aura:if inside each tab. The condition can be {!v.selectedTabId=='tab1'}. You can set the selectedTabId by using onactive on lightning:tab.
Thanks for your help!
I have searched for the solution for 2 days (asked multiple people and checked documentation) but couldn't find anything. So I have added an idea for salesforce to provide developers with Accessible Lightning Events from Lightning Page. If you think this Idea can be useful to you as a developer the please upvote.
Idea: Accessible Lightning Events from Lightning Page. (https://success.salesforce.com/ideaView?id=0873A000000CZbzQAG)
Thanks
workspaciAPI
if you can post your component code, it' ll help us to give exact solution to you