Reputation: 2657
I really don't understand why model is bound to proxy
and not to store
, so if I need a model for the store I have to do something like this:
var m = store.getProxy().getModel();
Is there any reason for Ext.data.AbstractStore to has no getModel() method?
Upvotes: 1
Views: 1703
Reputation: 23975
You are doing it wrong; The Store will not use the model of the proxy but it will use the proxy of the model if you don't define a own proxy for the store. And then you can access the model
property of the store.
If that didn't made it clear for you give me a comment and I will describe it more in deep along with a example.
Update
By now I took a closer look and I cannot really tell you why the getter is missing but the there is a public property model
on both store and proxy which should contain at least the modelname at the time a instance is created. By now you only get the modelname from the store so you need to resolve the modelconstructor first by calling something like this
Ext.ModelMgr.getModel(store.model);
Some additional info A more closer look at the source is quite confusing, I have to test it, but it seems there are some inconsistent.
In short
-> the proxy requires a model -> the store can take the proxy of a assigned model -> the store (seems to) always set the model of the proxy -> the proxy (when setting the model) can set the model of the store
I think they are preparing some things for the upcoming 4.2 release so that people didn't get to confused when their store model is undefined even if they have one assigned to the proxy (for example)
Upvotes: 1