PDA

View Full Version : MVC && File Structure



Ex_Soft
7 Feb 2012, 4:34 AM
app.js


Ext.Loader.setConfig({
enabled: true,
disableCaching: false
});

Ext.application({
name: "M3",

appFolder: "app",

autoCreateViewport: true
});

app/view/Viewport.js


Ext.define("M3.view.Viewport" , {
extend: "Ext.container.Viewport",
requires: ["maintbar"],
layout: "fit",
items: [
{
tbar: { xtype: "maintbar" } // Ext.create("M3.view.MainTbar")
}
]
});

app/view/MainTbar.js


Ext.define("M3.view.MainTbar" ,{
extend: "Ext.toolbar.Toolbar",
alias : "widget.maintbar",
items: [
{
xtype: "button",
text: "DoIt!"
}
]
});



"NetworkError: 404 Not Found - http://localhost/maintbar.js"

app/view/Viewport.js is successfully loaded when I use Ext.create("M3.view.MainTbar") instead of xtype. Why http://localhost/maintbar.js instead of http://localhost/app/view/maintbar.js?

friend
7 Feb 2012, 4:53 AM
I think the 'requires' class name should be fully qualified:



Ext.define("M3.view.Viewport" , {
extend: "Ext.container.Viewport",
requires: ['M3.view.MainTbar'],
layout: "fit",
items: [
{
tbar: { xtype: "maintbar" } // Ext.create("M3.view.MainTbar")
}
]
});