I am having issues getting a component once it has made it into v.body
. supposedly, v.body
is a Aura.Component[]
, but when I get one of its elements I cannot make it behave like a component (can't call methods, or do a .get('v.xxx')
.
Here is one simple example of what I mean
Markup
<lightning:tabset selectedTabId="checkin" aura:id="tabset">
<lightning:tab aura:id="checkinTab" label="1" id="checkin">
<c:myComp aura:id="myComp1" />
</lightning:tab>
<lightning:tab aura:id="inprocessTab label="2" id="inprocess">
<c:myComp aura:id="myComp2" />
</lightning:tab>
<lightning:tab aura:id="closedTab" label="3" id="closed">
<c:myComp aura:id="myComp3" />
</lightning:tab>
</lightning:tabset>
MyComp
<aura:component>
<aura:method name="doSomething" action="{!c.handledoSomething}"/>
</aura:component>
JS Code
//This gives me an error ('.get is not a function');
var myItem = component.find('tabset').get('v.body')[0];
var myLabel = myItem.get('v.label');
//This gives me an error ('.find is not a function');
var myItem = component.find('checkinTab').find('myComp1');
//This doesn't even work (myItem outputs as undefined)
var myItem = component.find('myComp1')
myItem.doSomething();
//This gives me an error ('.doSomething is not a function');
var myItem = component.find('checkinTab').get('v.body')[0];
myItem.doSomething();
How can I either get the system to find a method for a component inside a tabset, or at least allow me to retrieve that component so I can hit the method myself?
find
twice? Likeparent.find('child_id').find('inner_cmp_id')
v.body
behavior)