Reputation: 1057
I'm fairly new to both javascript and extjs and I encountered this problem while trying to run through the steps of the extjs 4.1 MVC Architecture tutorial. Evereything works fin in the beginning but when I try to add the controller to the application something goes wrong. Neither the applications launch function nor the controllers init function is called. I used the sample code from here here but I couldn't get the 'defining a controller' step working. It finds the Users.js there's no error message, still it won't call the controllers init function. If I remove the 'controllers: ['Users'],' the applications launch will be called. Any ideas what I'm missing?
app.js:
Ext.application({
requires: ['Ext.container.Viewport'],
name: 'Account Manager',
appFolder: 'app',
controllers: ['Users'],
launch: function() {...}
Users.js:
Ext.define('app.controller.Users', {
extend: 'Ext.app.Controller',
init: function() {
console.log('Initialized Users!');
}
});
Thank you for your time.
Upvotes: 1
Views: 2666
Reputation: 23973
Your error is (Ext.Application)
name: 'Account Manager',
Here's the API link for the name property.
Change it to:
name: 'app', // I would use camelcase here
Explanation:
You are not allowed to use spaces in the application name. Further it is more a namespace then a name. You have to use it in all of your classes (This will be the namespace for your views, controllers models and stores) afterwards.
Upvotes: 1