I'm experimenting with Sencha Touch 2 and ran into a problem with the NavigationView, because it won't work... Everytime I try to push a view I get the error Uncaught TypeError: Cannot call method 'apply' of undefined
and I don't know why...
If I initialize the first view inside the config-part of the navigation view it works fine, but if I try to push the exact same view into the NavigationView I get the error...
Here's some code of my views and controller:
The Controller:
Ext.define('svmobile.controller.MyController', {
extend: 'Ext.app.Controller',
alias: 'widget.mycontroller',
config: {
refs: {
mainView: 'main',
}
},
launch: function() {
this.callParent(arguments);
Ext.Viewport.add(Ext.create('svmobile.view.Main'));
this.getMainView().getNavigationBar().add(
{
xtype: 'navbutton',
align: 'right'
}
);
this.getMainView().push( //This is not working
{
xtype: 'hostspie'
}
);
},
...
The NavigationView:
Ext.define('svmobile.view.Main', {
extend: 'Ext.navigation.View',
xtype: 'main',
alias: 'widget.main',
config: {
items: { //This way it works
xtype: 'hostspie'
}
}
});
The view to push:
Ext.define('modules.nagios.view.HostsPie', {
extend: 'Ext.Panel',
alias: 'widget.hostspie',
requires: [
...
],
config: {
layout: 'fit',
title: 'Dashboard',
items: [
{
xtype: 'polar',
...
}
]
}
});
Any ideas why it is not working as it should?
this.getMainView().getNavigationBar()
andthis.getMainView()
coming as an object... – pyriand3r