PDA

View Full Version : ExtJS parsenamespace returning undefined



richard.styles
5 Jan 2015, 10:05 AM
I have been getting a number of errors, when running a production compiled app from Sencha Architect.


Uncaught TypeError: undefined is not a function
Ext.ClassManager.parseNamespace
Ext.ClassManager.isCreated
Ext.apply.require
(anonymous function)
Ext.apply.doProcess
Ext.apply.process
Ext.Class.c
Ext.ClassManager.create
Ext.apply.defineRating.js
(anonymous function)


I have added some debug output to the class source, so that when Architect builds it the debug is compiled as part of the production code.


Which displays the following



["Ext.form.field.Number"]
Ext.form.field.Number <- this is the class to lookup possible classname expressions from
[Array[2]]
[Array[2]]
0: Array[2] <- returns an array of 2, where 1: = undefined.
0: "Ext.form.NumberField"
1: undefined
length: 2
__proto__: Array[0]
length: 1
__proto__: Array[0]
Object {p: Array[0], r: Array[1], root: Window, n: Array[2]}

This debug is added to the function Ext.Loader.require, just before the iteration on line:981


scope = scope || Ext.global;
console.log("Class Loader expressions");
console.log(expressions);
for (i = 0,ln = expressions.length; i < ln; i++) {
expression = expressions[i];
console.log(":::");
console.log(expression);
if (typeof expression == 'string' && expression.length > 0) {
possibleClassNames = Manager.getNamesByExpression(expression);
subLn = possibleClassNames.length;
console.log(possibleClassNames);
for (j = 0; j < subLn; j++) {
possibleClassName = possibleClassNames[j];
console.log(possibleClassNames);

All this suggests to me that there are core class elements which are returning an undefined value for a class name. Yet Sencha Architect should/does do most of the heavy lifting when linking up class names.
When the application is compiled using develop option then the application works as expected and does not throw any errors.

This error is being thrown regardless if the controller is loaded dynamically or if it is included above Ext.onReady().

Also I have included quite a few of the core components in Ext.application


Ext.application({

requires: [
'Ext.Loader',
'Ext.panel..*',
'Ext.button.*',
'Ext.grid.*',
'Ext.toolbar.*',
'Ext.tip.*',
'Ext.window.*',
'Ext.dd.*',
'Ext.chart.*',
'Ext.util.*',
'Ext.tree.*',
'Ext.menu.*',
'Ext.layout.*',
'Ext.form.*'
],

I'm not quite sure where to look now as it seems to be occurring on the loading of core Ext components.
Does anyone have any suggestions of where I should be looking?

Further investigations seems to show that Ext.form.field.base is causing this. When debugging the Class Manager function getNameByAlternate to list the current
this.maps.getNameByAlternate
The alternate names for Ext.form.field.Base contains an undefined value, this seems to be propagated to the child classes.

Ext.form.FileUploadField which is also a child class, has two undefined values which correspond to:

Ext.form.File
Ext.ux.form.FileUploadField


So somewhere these are either not getting added from Ext.form.* or something else.

lumberjack
14 Jan 2015, 9:40 AM
What version of Ext JS is in use in your project?

Regards,
Brian