View Full Version : Help with Ext.data.Store

14 Jul 2013, 7:01 PM
Hi there,

I am currently upgrading an existing ExtJS based system from 2.2 to 3.4 now 4.2.1.
I am having some trouble around the upgrade from 3.4 to 4.2.1 regarding Ext.data.Store.

Before, there seemed to be no need for a 'proxy' or a 'model' when creating a data.Store. But now I am getting errors because they are set-up.

I looked into this and saw that I need to create Models that are defined by extending Ext.data.Model, the only problem with this is that whenever new model/classes get created (in an external system), there is a tool that automatically generates the JavaScript, not in the required Model format.

The current set-up I am working with is like this:

store = new Ext.data.Store({
reader: new Ext.data.XmlReader({
record: repeatedStoreField
}, fields),
data: xml

'repeatedStoreField' is the name of the class
'fields' is an array of field names
'xml' is the raw xml returned from the webserivce

And an example of a generated class I am working from (of which there are hundreds):

WS_Operator: function(obj){
if (!obj){
obj = {};
this.WS_ProxyObject(obj); //add attributes from superclass
obj.code = null; //(String)
obj.comboboxDescription = null; //(String)
obj.description = null; //(String)
return obj;

I am wondering if there is anyway I can work around the 'proxy' and 'model' requirements when creating a Store, or if I am able to build it dynamically from what I already have?

Any help would be much appreciated!
If more detail is needed, please let me know.


[Edit] :
As a bit more detail, the place I am getting an error is on

me.setProxy(me.proxy || me.model.getProxy());
Which is within the Ext.data.AbstractStore constructor

16 Jul 2013, 11:57 AM
You dont' have to have a proxy and model configured in the store in the simplest of examples, but the reader is set up on the proxy. So, you can do something like:

new Ext.data.Store({
fields: fields,
data: xml,
proxy: {
type: 'memory',
reader: {
type: 'xml',
record: repeatedStoreField