ExtJS 4 - Unable to read the substring property undefined

I'm new to Ext JS 4, and I'm currently developing a fairly sophisticated Ext JS MVC application that follows the architecture described in this (basic) tutorial.

http://docs.sencha.com/extjs/4.0.7/#%21/guide/application_architecture .

Almost all the time when I add a new view with the appropriate model, controller, and repository, as a first step I have to fix the wrong alias or identifier. This is very difficult because ext does not help me as I expected, and there are many of these identifiers to search for.

Using Firebug, the error message pointed to me:

Uncaught TypeError: Cannot read property 'substring' of undefined localhost:8080/Web/extjs4/ext-debug.js:5246

Is there a way to quickly figure out where the abuse happens?

This is the part of the code to which 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;
        },

.

+4
1

console.log(Ext.getClassName(someObj)); - JSLint - !

+1

All Articles