日々精進

新しく学んだことを書き留めていきます

Extjs4 Uncaught TypeError: Cannot call method 'substring' of undefined

下記のエラーを解決したのでメモ。

Uncaught TypeError: Cannot call method 'substring' of undefined ext-all-debug-w-comments.js:5981
Ext.ClassManager.parseNamespaceext-all-debug-w-comments.js:5981
Ext.ClassManager.getext-all-debug-w-comments.js:6100
Ext.ClassManager.instantiateext-all-debug-w-comments.js:6390
Ext.ClassManager.instantiateByAliasext-all-debug-w-comments.js:6356
(anonymous function)ext-all-debug-w-comments.js:2414
Ext.define.createext-all-debug-w-comments.js:24548
Ext.define.createComponentext-all-debug-w-comments.js:41979
Ext.define.lookupComponentext-all-debug-w-comments.js:41967
Ext.define.prepareItemsext-all-debug-w-comments.js:41938
Ext.define.addext-all-debug-w-comments.js:42067
Ext.define.addext-all-debug-w-comments.js:42057
Ext.define.initItemsext-all-debug-w-comments.js:41834
・・・

これはクラス定義ファイルを読み込めていないことが原因。
でもapp.jsやコントローラのrequiresにクラス名を書いても解決しなかった。。
しょうがないのでExt.requireを使ってみたところ解決しました。

Ext.onReady(function () {
    Ext.Loader.setConfig({
    	enabled: true
    });
    Ext.Loader.setPath({
        'Real': 'http://localhost/Real/app'
        });
    Ext.require('Real.view.Editor');
});