Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jan 2011
    Location
    Lincoln RI
    Posts
    97
    Vote Rating
    0
    webarnie is on a distinguished road

      0  

    Default Recordtype undefined for JsonStore and ArrayStore

    Recordtype undefined for JsonStore and ArrayStore


    If I defined my store as a grouping store as follows:

    Code:
    paymentStore = Ext.extend(Ext.data.GroupingStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            paymentStore.superclass.constructor.call(this, Ext.apply({
                storeId: 'paymentStore',
                root: 'data',
                reader : new Ext.data.JsonReader( {
                fields: [
                    {
                        name: 'paymentType',
                        allowBlank: false,
                        mapping: 'paymentType',
                        type: 'int'
                    },
                    {
                        name: 'cash',
                        allowBlank: false,
                        mapping: 'cash',
                        type: 'float'
                    },
                    {
                        name: 'check',
                        allowBlank: false,
                        mapping: 'check',
                        type: 'float'
                    }
                ]
                } )
            }, cfg));
        }
    });
    new paymentStore();
    The store.recordType works as expected. If I change the definition to either a JsonStore or ArrayStore, the store.recordType is undefined. The documentation for all 3 store are the same but underlaying behavior is not. Why? Is this a bug? What do I have to change to get recordType for JsonStore or ArrayStore?

  2. #2
    Sencha User
    Join Date
    Sep 2008
    Posts
    118
    Vote Rating
    1
    RobWilson is on a distinguished road

      0  

    Default Same in extjs4?

    Same in extjs4?


    I haved used designer to create my json store, but store.recordType is undefined for me too (store is okay).

  3. #3
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default jsonstore overwrites your reader

    jsonstore overwrites your reader


    Hi,

    Please see the definition of JsonStore (same for ArrayStore):

    Ext.data.JsonStore = Ext.extend(Ext.data.Store, {
    constructor: function(config){
    Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
    reader: new Ext.data.JsonReader(config)
    }));
    }
    });

    It overwrites your reader if you extend JsonStore/ArrayStore and passes config directly into the reader. But in your example, you're trying to pass your fields into your reader and they are gone. And the result is a reader without any fields definition. So it does not create any recordType.

    If you remove the reader, and put fields into the config, it would probably work. See below:

    Code:
    paymentStore = Ext.extend(Ext.data.JsonStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            paymentStore.superclass.constructor.call(this, Ext.apply({
                storeId: 'paymentStore',
                root: 'data',
    fields: [
    { name: 'paymentType', allowBlank: false, mapping: 'paymentType', type: 'int' }, { name: 'cash', allowBlank: false, mapping: 'cash', type: 'float' }, { name: 'check', allowBlank: false, mapping: 'check', type: 'float' } ]
    }, cfg)); } }); new paymentStore();
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Thread Participants: 2