Populate component on create

Hi there.. I have the next problem:
I have a Panels component like this

module.exports = kind({
name: "myapp.MainView",
classes: "moon enyo-fit main-view",
pattern: 'activity',
components: [
{
kind: Panels,
pattern: 'activity',
name: 'homePanels',
popOnBack: true,
preventKeyNavigation: true,
classes: "enyo-fit full",
components: [
{
kind: Panel,
components: [
{ kind: Button, content: 'Do it!', ontap: 'foo' }
]
}
]
}
],
foo: function() {
this.$.homePanels.pushPanel({
kind: Panel, components: [{kind: Item, name: 'myTable', create: function() { populateTable(this.$.myTable, someList); }}]
});
}
});


As you can see, when 'foo' is called, I add a new panel to 'homePanels'. The thing is, when this new panel is created I want to populate it with some info using this function called 'populateTable' (inside of this function I use the method 'createComponent')..
The problem is, the argument passed to populateTable 'this.$.myTable' seems to be undefined, so it's like if the component 'myTable' is not defined till the funciont 'foo' finish its execution or something like that..
Do you guys have another idea of how can I access to that component in order to populate it with information ??
Thank you!

Comments

Sign In or Register to comment.