Javascript 如何在ExtJS 5.1中为MVC设置app.js?

Javascript 如何在ExtJS 5.1中为MVC设置app.js?,javascript,model-view-controller,extjs,Javascript,Model View Controller,Extjs,我试图通过RESTful服务创建一个网格面板。我已经创建了所有必需的文件,但不知何故ExtJS不会触发/运行应用程序。正如我通过Chrome开发工具的“网络”选项卡注意到的,所有文件都在加载,但它不是任何浏览器视图!我正在使用ext all debug查看正在发生的事情,但控制台上没有任何错误 所以我想我可能遗漏了ExtJS 5.1.1的MVC应用程序架构师在运行应用程序时的一些东西 请检查一下基本文件夹结构和下面的“app.js”好吗 文件夹: root/ index.html app.js

我试图通过RESTful服务创建一个网格面板。我已经创建了所有必需的文件,但不知何故ExtJS不会触发/运行应用程序。正如我通过Chrome开发工具的“网络”选项卡注意到的,所有文件都在加载,但它不是任何浏览器视图!我正在使用ext all debug查看正在发生的事情,但控制台上没有任何错误

所以我想我可能遗漏了ExtJS 5.1.1的MVC应用程序架构师在运行应用程序时的一些东西

请检查一下基本文件夹结构和下面的“app.js”好吗

文件夹:

root/
index.html
app.js

..app/
...model/
....Model.js

...store/
....Store.js

...view/
....Main.js
....Header.js
....orest/
.....List.js
.....Form.js
下面是app.js的文件:

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


Ext.application({
    models: [
        'Model'
    ],
    stores: [
        'Store'
    ],
    views: [
        'Main'
    ],
    name: 'ORest',

    launch: function() {
        Ext.create('ORest.view.Main');
    }

});
编辑1: 下面是Main.js,调用Header和Cards类:

Ext.define('ORest.view.Main', {
        extend: 'Ext.container.Viewport',
        alias: 'widget.main',

        requires: ['ORest.view.Header', 'ORest.view.Cards'],
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    padding: 5,
    items: [{
        xtype: 'header',
        height: 80
    }, {
        xtype: 'thecards',
        flex: 1 
    }]
});
Header.js:

Ext.define('ORest.view.Header', {
    extend: 'Ext.container.Container',
    xtype: 'theheader',
    //requires: ['Ext.toolbar.Toolbar'],
    layout: {
        type: 'hbox',
        align: 'stretch'
    },
    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            items: [{
                xtype: 'container',
                cls: 'logo',
                width: 300
            }, {
                //Search will come here!
            }]
        });
        me.callParent(arguments);
    }
});
和Cards.js:

Ext.define('ORest.view.Cards', {    
    extend: 'Ext.container.Container',
    xtype: 'thecards',
    requires: ['Ext.layout.container.Card', 'ORest.view.orest.ManageOrest'],
    layout: 'card',
    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            items: [{
                xtype: 'themanageorest',
                itemId: 'manageOrestCard'
            }]      
        });
        me.callParent(arguments);
    }
});
这就是解决方案

应用程序未在浏览器上运行,因此我认为应用程序架构师(与MVC模式相关)在引导方面存在问题

但我刚刚发现,app.js文件中并没有出现错误,从这个意义上讲,这是引导-
,所有这些都是关于商店定义的(我不会更深入地解释,将是prolixity)

总之是这样;如果有人要创建基于MVC的ExtJS 5.1.1应用程序,可以使用此文件夹/文件结构来引导应用程序


非常感谢

我刚刚在app.js的“launch”属性上运行了一个alert和console.log,它们都工作得很好!向我们展示“ORest.view.Main”的代码class@scebotari66我又增加了2个类,它们通过Main调用,并继续调用2-3个类。我从Packt出版的《带ExtJS的企业应用程序》一书中得到了一个教程,不要问我为什么,但是如果使用
Ext.create
,视口不会自动添加到主体中。您要做的是使用如下配置:
mainView:'ORest.view.Main',
@Alexander感谢您的回复,但它也没有引导!但是我发现List.js类中有一些错误。看起来像商店配置!我会尽快检查并记录下情况。