PDA

View Full Version : unable to override constructor



sormy
6 May 2013, 11:07 AM
i added this script to requires property of application, but it seems like ExtJS do not reach this code after override.



Ext.define("App.patches.data.association.BelongsTo.AssociatedNameForModelWithinNamespace", { override: "Ext.data.association.BelongsTo",
constructor: function(config) { console.log("1234");
this.callParent(arguments);
var me = this, ownerProto = me.ownerModel.prototype, associatedName = me.associatedName.replace(/^[^.]+\.model/, ''), // patch, getterName = me.getterName || 'get' + associatedName, setterName = me.setterName || 'set' + associatedName;
Ext.applyIf(me, { name : associatedName, foreignKey : associatedName.toLowerCase() + "_id", instanceName: associatedName + 'BelongsToInstance', associationKey: associatedName.toLowerCase() });
ownerProto[getterName] = me.createGetter(); ownerProto[setterName] = me.createSetter(); }});

sormy
6 May 2013, 1:16 PM
can be closed, component loaded before override was applied (via require)