I have two tabs, based on the inserted record in first tab, I'm displaying data in the second tab from server. if I go back to first tab and update the inserted record and then click on second tab it is still displaying data based on my inserted records

I want my records in the second tab should be displayed based on the recently updated records.

to display records in the second tab I have created one separate component and on its "init" I'm doing server-side call. but it seems "init" is always called only on the first occurrence.

I also tried using aura:method, but it gives error "[childComponent.myMethod is not a function]"

Child Component:

<aura:method name="myMethod" action="{!c.executeMyMethod}"> 
        <aura:attribute name="param1" type="Obj1[]"/> 
        <aura:attribute name="param2" type="Obj2"/> 

Child controller:

executeMyMethod : function (component, event, helper) {
        console.log("Inside Execute method.. ");
        var params = event.getParam('arguments');
        console.log('Param 1: '+ params.param1);
        console.log('Param 2: '+ params.param2);

Parent Component:

<aura:attribute name="cost" type="integer"  default="1"/>
<aura:attribute name="insetedObj1" type="Obj1[]"/>
<aura:attribute name="recordObj2" type="Obj2"/>
    <ui:inputNumber value="{!v.cost}" />

    <button class="slds-button" disabled="false"

<lightning:tab id="second">
    <c:childComponent aura:id="child"/>

Parent Controller:

    getChild: function(component, event, helper){  
    var costvalue = component.get("v.cost");
    var action = component.get("c.getChildRecord");

    action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            var result = response.getReturnValue();

            var attribute1 = component.get('v.insetedObj1');
            var attribute2 = component.get('v.recordObj2');
            var childComponent = component.find('child');
            childComponent.myMethod(attribute1, attribute2);

  • I guess the same we can achieve with the attributes, no need of aura:method, what you say? Commented Feb 17, 2018 at 6:30

1 Answer 1


Solved the error by giving access=public attribute

<aura:method name="myMethod" action="{!c.executeMyMethod}" access="PUBLIC">

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .