Reputation: 5603
I have this code
Ext.define('Header', {
getItems: function() {
return somepanel;
}
items: [this.getItems()]
});
This is not working. i get error that getItems is not defined
Upvotes: 0
Views: 103
Reputation: 30082
Your question is a bit vague, however, you can add a template method:
Ext.define('MyContainer', {
extend: 'Ext.container.Container',
initComponent: function() {
this.items = this.createItems();
this.callParent();
},
createItems: function() {
return [{title: 'Foo'}];
}
});
Upvotes: 1
Reputation: 1254
this is the context where Ext.define('Header'...) is being executed. I guess that's the window.
I don't get properly what you want to do, but if you want to fill item property with the function you need to call it:
items: function() {
return somepanel;
}()
Upvotes: 0