PDA

View Full Version : Newbie: Pass data to a nested component



deeoh
16 Aug 2013, 6:24 AM
Hello,

I have a container, in which I have nested a tabpanel. I'd like to be able to send html to the individual tabs.

How do I get html into Tab 3 from the controller?

I call the outmost container thus:


detailForm = Ext.create('MyApp.view.MyContainer7', {});
this.getMainNav().push(detailForm);


The container is described below:


Ext.define('MyApp.view.MyContainer7', {
extend: 'Ext.Container',

config: {
items: [
{
xtype: 'tabpanel',
items: [
{
xtype: 'container',
title: 'Tab 3'
}
]
}
]
}

});

Thanks.

aconran
16 Aug 2013, 11:52 AM
Get a reference to the container that you've given a title of "Tab 3".

I'd suggest putting an itemId on this and then retrieving it via #myItemId component query.

You would then call the setHtml method.

For example



// if you setup a reference named myTab3
// getMyTab3 will be generated automatically for you in the controller.
var myTab = this.getMyTab3();
myTab.setHtml('<h1>Hi!</hi>');

deeoh
17 Aug 2013, 1:54 AM
Hello aconran.

Thanks for this. It makes sense and I will implement it.