ExtJS4.0在搭建mvc框架是出现的错误总结

uncaught exception: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: AM.controller.users

原因是Ext默认不开启动态加载

解决办法:

在aap.js中加入这么一句话

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

   ...
    });
})();

requires.push is not a function

发现问题出在app.js: controller:['users']上,一旦去掉这句话,页面是能出来的,一加上,问题就会出来。最后发现,extjs包里的Application.js运行app的代码如下

var requires = config.requires || [], controllers, ln, i, controller, paths, path, ns; if (this.autoCreateViewport) { requires.push(this.getModuleClassName('Viewport', 'view')); }
其中,config.requires就是app.js中requires属性,这里的变量requires是个数组,而我的app.js的 requires属性配置不是数组,所以导致这里的变量requires=config.requires||[ ]变成了一个字符串,而不是数组,以致运行到requires.push的时候,提示这个function不存在,所以只要把app.js 里,requires属性改成如下:

requires:['Ext.container.Viewport']

 

 

posted @ 2012-07-16 14:10  修炼之道  阅读(369)  评论(1)    收藏  举报