I've tried the simple MVC example like this How to properly activate an MVC View in Sencha Touch V2 . It's ok, but let's say i want to add a button in the panel using a view.
I've tried to do following..
app.js :
Ext.Loader.setConfig({enabled: true});
Ext.application({
name: 'rpc',
appFolder: 'app',
controllers: ['Home'],
launch: function () {
Ext.create('Ext.tab.Panel',{
fullscreen: true,
tabBarPosition: 'bottom',
items:[{
title: 'Home',
iconCls: 'home',
html: '<img src="http://staging.sencha.com/img/sencha.png" />'
},{
title: 'Compose',
iconCls: 'compose',
xtype: 'mybutton'
}]
});
}
});
control
Ext.define('rpc.controller.Home', {
extend: 'Ext.app.Controller',
views: ['home.Button'],
init: function() {
console.log('Home controller init method...');
}
});
view
Ext.define('rpc.view.home.Button', {
extend: 'Ext.Panel',
alias: 'widget.mybutton',
initialize: function() {
this.items = [
{
xtype: 'button',
cls : 'demobtn',
flex : 1
}]
;
this.callParent();
}
});
The result i receive is :
Uncaught TypeError: Cannot read property 'length' of undefined
Where is the error? What is the right way to add the button using a view with MVC in Sencha Touch 2.0 ?
Thanks.