-
4 Aug 2012 7:42 PM #1
Answered: ext js 4 MVC tutorial do not work ...
Answered: ext js 4 MVC tutorial do not work ...
ok ... for some reason the code that i get from the EXT JS 4 MVC architecture do not work.
i can't load the controller ... i don't understand why ... please help.
need to use controller for it won't work at all !!!
app.js
--------
Ext.application({
name: 'AM',
appFolder: 'app',
controllers: ['AM.controller.Users'], // ---> if i remove this, it will work but i wont have a controller
launch: function () {
var me = this;
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Users',
html: 'List of users will go here'
}
]
});
console.log('hello from app.js');
}
});
controller
------------
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
init: function () {
console.log('hello1 from controller Users.js');
this.control({
'viewport > panel': {
render: this.onPanelRendered
}
});
},
onPanelRendered: function () {
console.log('hello2 from controller Users.js');
}
});
-
Best Answer Posted by fmuke
thank you guys for your help ....
i found the annoying problem ...
Ext.Loader.setConfig({enabled: true});
Ext.require('Ext.container.Viewport');
Ext.application({
name: 'App',
appFolder: '/NUKEAPPS/app', //<---here is the mistake . i needed to specify the app right location
controllers: ['Books'],
launch: function() {
console.log('called function launch - application');
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Books',
html : 'List of books will be displayed here'
}
]
});
}
});
-
4 Aug 2012 7:44 PM #2
this is the example on EXT JS 4 MVC architecture from this website...
im learning ext js ... and when trying the example... everything work except the controller ...
-
4 Aug 2012 8:28 PM #3Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,067
- Vote Rating
- 96
- Answers
- 166
From the docs:
Ext.application({
...
controllers: [
'Users'
],
...
});Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
5 Aug 2012 1:15 AM #4
--- i did tried the cold below but it does t work ... i doesn't call the controller since the console.log do note send the message... been trying...still nothing
Ext.application({
name: 'AM',
appFolder: 'app',
controllers: ['Users'],
launch: function () {
var me = this;
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Users',
html: 'List of users will go here'
}
]
});
console.log('hello from app.js');
}
});
-
5 Aug 2012 1:30 AM #5
@fmuke,
I have tried to run your code with Ext 4.1.1 and Chrome browser and it works well. I think, your problem is that the Users controller could not be loaded. So try to check the filename and pathname of Users controller. Make sure its pathname is ".../app/controller/Users.js"
-
5 Aug 2012 9:20 AM #6
tks for the help ...
were u able to get a the message "console.log('hello2 from controller Users.js');"
-
5 Aug 2012 2:26 PM #7
Find the problem
Find the problem
thank you guys for your help ....
i found the annoying problem ...
Ext.Loader.setConfig({enabled: true});
Ext.require('Ext.container.Viewport');
Ext.application({
name: 'App',
appFolder: '/NUKEAPPS/app', //<---here is the mistake . i needed to specify the app right location
controllers: ['Books'],
launch: function() {
console.log('called function launch - application');
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Books',
html : 'List of books will be displayed here'
}
]
});
}
});


Reply With Quote