PDA

View Full Version : Ext 4.2: Why model prototypes do not have a proxy instance any longer



DiscoBoy
25 Feb 2014, 3:30 AM
This is something I absolutely h*** about ExtJS. All the internal changes constantly breaking code...

...so the problem is that I was creating a static model function using the previously proxy instance in a model.



Ext.define('App.model.app.Server', {
extend: 'Ext.data.Model',
proxy: {...}

statics: {
connect: function() {
this.prototype.proxy.doSomething()
}
}
});


Now, the proxy is only the config object, but no real instance any longer. I guess this was introduced to use less memory and to create less object instances, or? Is there any other reason for this?

mitchellsimoens
3 Mar 2014, 8:11 AM
You should have been using this.getProxy() instead of this.prototype.proxy

brian428
3 Mar 2014, 9:03 AM
This is something I absolutely h*** about ExtJS. All the internal changes constantly breaking code...Now, the proxy is only the config object, but no real instance any longer. I guess this was introduced to use less memory and to create less object instances, or? Is there any other reason for this? If you bypass the public API and go digging into objects, you really can't act shocked if an internal change breaks your code.

DiscoBoy
4 Mar 2014, 3:15 AM
I'm sorry for writing this a bit harsh. I just noticed it quite often that things change fundametely between every minor version. I helped myself now exactly with


this.setProxy(this.prototype.proxy);

in my static method. As background information I overwrite the Ext.data.Model.load method of the model in a Factory class approach. Sometimes you have to bypass the public API.

Thx for your replies

brian428
4 Mar 2014, 7:22 AM
I overwrite the Ext.data.Model.load method of the model in a Factory class approach. Sometimes you have to bypass the public API.

Oh, I totally agree. I've had to override plenty of things to work around problems or limitations in Ext JS. I'm just saying that when we do that, we really can't be surprised if something changes that messes things up. It can definitely be annoying, but internal changes that break overrides and such still has to be kept in mind as a very likely possibility.