使用ExtJs 4.2.1进行DeftJs 0.9.1

时间:2013-10-28 15:25:00

标签: extjs extjs-mvc extjs4.2 sencha-cmd deftjs

我很难让DeftJs与Sencha Cmd合作。起初我怀疑是Cmd 4,但我也尝试使用Cmd 3,结果完全相同,所以我觉得我只是错过了一些东西。

当调用Ext.onReady()时,我收到错误“无法设置未定义的属性'实例'”。 Ext.app.Application应该在以下时间定义:

Ext.onReady(function() {
    // this won't be called until App has been created and its requires have been met...
    Ext.app.Application.instance = new App(); // Ext.app.Application is undefined.
});

我正在按照https://github.com/deftjs/DeftJS/wiki/Adding-Deft-JS-to-Your-Application#using-sencha-cmd-with-deft-js-09-only

使用Sencha Cmd(仅限DeftJs 0.9+)的说明进行操作

非常感谢任何有关出错的线索。

1 个答案:

答案 0 :(得分:0)

Application.js文件(位于项目的app文件夹中)中,请确保在Ext.app.Application中加入requires

Ext.define("Phoenix.Application", {
  extend: "Deft.mvc.Application",
  requires: [
    "Deft.mixin.Controllable",
    "Deft.mixin.Injectable",
    // other required files,
    "Ext.app.Application" // <=========== HERE'S THE MISSING PIECE
  ],

  init: function() {
    this.beforeInit();
    Deft.Injector.configure(this.buildInjectorConfiguration());
    //Deft.promise.Deferred.enableLogging = false;
    return this.afterInit();
  },

  // other startup code
});