1. #1
    Sencha Premium Member
    Join Date
    Jul 2013
    Posts
    31
    Answers
    1
    Vote Rating
    1
    jademasterterminal is on a distinguished road

      0  

    Default Unanswered: Help with Ext.data.Store

    Unanswered: Help with Ext.data.Store


    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:

    Code:
    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):

    Code:
    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.

    Thanks.

    [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

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,334
    Answers
    427
    Vote Rating
    197
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    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:

    Code:
    new Ext.data.Store({
        fields: fields,
        data: xml,
        proxy: {
            type: 'memory',
            reader: {
                type: 'xml',
                record: repeatedStoreField
            }
        }
    });
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

Thread Participants: 1