PDA

View Full Version : Issue in Ext.data.Model onClassExtended



allistar
5 May 2013, 7:07 PM
Hi there,
We are getting the error:



TypeError: associationsConfigs[i].type is undefined
dependencies.push('association.' + associationsConfigs[i].type.toLowerCase());


When we create a new model class which extends our base model class (which in turn extends Ext.data Model).

In the "onClassExteneded" I have added in this debugging:



if (superAssociations) {
console.log(associationsConfigs.length);
console.log(superAssociations.items.length);
associationsConfigs = superAssociations.items.concat(associationsConfigs);
console.log(associationsConfigs.length); }


Which results in this being output to the console:


0
0
1

Which is bizarre. How can two collections that are both empty be concatenated together to create a new collection which has 1 entry? That single entry is a a MixedCollection (which has zero items), and because it has no "type" property the line of code in this loop fails:



for (i = 0, ln = associationsConfigs.length; i < ln; ++i) {
dependencies.push('association.' + associationsConfigs[i].type.toLowerCase());
}


We do not use associations at all in our model classes.

This is with ExtJS version 4.1.3.548.

Does anyone have any ideas on this issue?

allistar
6 May 2013, 1:36 AM
I have discovered the cause of it - I had code that was incorrectly creating two Ext.data.Model classes with the same name.