In parent component, I have lightning:TabSet tag. In this tag I have child component name 'createTab' and in its JS controller I am creating three child component using $A.createComponent method that will correspond to three tabs.

My requirement is when I am on second tab, I select some record -> click on button and save selected record to DB. When I click on third tab, I want to get the records that I selected in second tab. (Third tab only show record when I refresh the page). But I want that when I select record on second tab, click button and navigate to third tab, it should show the latest record selected without hitting refresh.

In init method of third component js file, I am getting record. So I just want to inovke the init method of third component when third tab is clicked. But init is not invoked becasue component are already loaded in start.

Any help would be appreciated.

<lightning:tab label="Item One" id="one" onactive="{!c.activeHnadler}">

You can add a onactive handler to tab. Whenever inactive handler is called , you can find id of tab using event.getSource().get('v.id'); and then use aura method on you child component to start init logic.

  • If you can post your code we can be able to give detailed solution of your problem. – Manjot Singh Nov 15 '18 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.