Reputation: 496
I am new to Ext JS 4 and I am currently developing a pretty complex Ext JS MVC application that follows the architecture explained in this (basic) tutorial.
http://docs.sencha.com/extjs/4.0.7/#%21/guide/application_architecture.
Almost all the times I add a new view with the related model, controller and store, as first step I have to fix some mispelled alias or id. It comes to be very tricky since ext does not help me as I would expect, and there is a lot of these ids to look for.
Using Firebug, the error message given to me is:
Uncaught TypeError: Cannot read property 'substring' of undefined localhost:8080/Web/extjs4/ext-debug.js:5246
Is there a way to quickly undestand where the mispelling is?
This is the code portion where the exception is thrown
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;
},
Thanks in advance.
Upvotes: 4
Views: 4253
Reputation: 21
I sanity check my code with console.log( Ext.getClassName(someObj) ); -- sometimes JSLint can help you find unused variables -- Good Luck!
Upvotes: 1