【发布时间】:2014-07-30 13:08:51
【问题描述】:
我是 Ext JS 4 的新手,我目前正在开发一个非常复杂的 Ext JS MVC 应用程序,它遵循本(基本)教程中解释的架构。
http://docs.sencha.com/extjs/4.0.7/#%21/guide/application_architecture。
几乎所有时候我都会添加一个带有相关模型、控制器和存储的新视图,作为第一步,我必须修复一些拼写错误的别名或 ID。这变得非常棘手,因为 ext 并没有像我期望的那样帮助我,并且有很多这样的 id 需要寻找。
使用Firebug,给我的错误信息是:
Uncaught TypeError: Cannot read property 'substring' of undefined localhost:8080/Web/extjs4/ext-debug.js:5246
有没有办法快速找出拼写错误的位置?
这是引发异常的代码部分
parseNamespace: function(namespace) {
var cache = this.namespaceParseCache,
parts,
rewrites,
root,
name,
rewrite, from, to, i, ln;
if (this.enableNamespaceParseCache) {
if (cache.hasOwnProperty(namespace)) {
return cache[namespace];
}
}
parts = [];
rewrites = this.namespaceRewrites;
root = global;
name = namespace;
for (i = 0, ln = rewrites.length; i < ln; i++) {
rewrite = rewrites[i];
from = rewrite.from;
to = rewrite.to;
// 5246
if (name === from || name.substring(0, from.length) === from) {
name = name.substring(from.length);
if (typeof to != 'string') {
root = to;
} else {
parts = parts.concat(to.split('.'));
}
break;
}
}
parts.push(root);
parts = parts.concat(name.split('.'));
if (this.enableNamespaceParseCache) {
cache[namespace] = parts;
}
return parts;
},
提前致谢。
【问题讨论】:
标签: javascript extjs4