PDA

View Full Version : [patch] Subclass-aware Ext.data.Record.create



GArrow
26 Sep 2007, 9:07 AM
It is presently impossible to subclass Ext.data.Record without providing a full replacement of the static 'create' method, because it hard codes Ext.data.Record:


Ext.extend(f, Ext.data.Record);

The solution is to replace the class with 'this':


Ext.extend(f, this);

This permits a subclass to provide an augmented implementation of the create method such as:


Ext.data.FooRecord.create = function (config, o) {
var f = Ext.data.Record.create.call(this, o);
Ext.apply(f.prototype, config, {
foo : 1,
bar: false
});
return f;
};