I'm trying to write my first simple mvc app. I have a Main View and a Products view. I also have a Main controller. My Products view extend Ext.List. My problem is the list doesn't show anything even though I've set the data and itemTpl. Here is my code:
app.js
Ext.application({
name: 'SenchaTest',
controllers: ['Main'],
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
Ext.create('SenchaTest.view.Main');
},
});
view/Main.js
Ext.define('SenchaTest.view.Main', {
extend: 'Ext.TabPanel',
requires:['Ext.data.Store'],
config: {
fullscreen: true,
items:[
{
xtype:'productspage',
title:'Products',
data: [
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 4' }
],
itemTpl:'{title}'
}
]
},
initialize: function() {
console.log('Main view initialize');
}
});
view/Products.js
Ext.define('SenchaTest.view.Products', {
extend: 'Ext.List',
xtype: 'productspage',
initialize: function() {
console.log('Products view initialize');
},
});
controller/Main.js
Ext.define('SenchaTest.controller.Main',{
extend: 'Ext.app.Controller',
config:{
views:['Main', 'Products'],
},
launch: function() {
console.log('Main Controller launch');
},
init: function() {
console.log('Main Controller init');
}
});
Here is what appears in my console:
Main Controller init
Products view initialize
Main view initialize
Main Controller launch
So my views and controller are initiated. But nothing shows in my products list. The list component does seem to have been loaded because i can see scrollbars when dragging it.
The weird thing is if I change the xtype: 'productspage' to xtype:'list' .... it works .... but my products view extend Ext.List ... so isn't it the same?