0

I'm unable to load inline array data into a store. In particular, this fails. Can someone explain why? I even tried adding a memory proxy with an array reader and still no dice.

Ext.define('MyApp.store.ComboboxState', {
extend: 'Ext.data.Store',

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        autoLoad: true,
        storeId: 'ComboboxState',
        data: [
            [
                'AL',
                'Alabama'
            ]
           ]
        ,fields: [
            {
                name: 'state'
            },
            {
                name: 'name'
            }
        ]
    }, cfg)]);
}
});

Still doesn't work with this memory proxy/array reader:

        proxy: {
            type: 'memory',
            reader: {
                type: 'array'
            }
        }
U Avalos
  • 6,538
  • 7
  • 48
  • 81

1 Answers1

0

Just extend from ArrayStore, like this:

Ext.define('MyApp.store.ComboboxState', {
    extend: 'Ext.data.ArrayStore',

    constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
        me.callParent([Ext.apply({
            autoLoad: true,
            storeId: 'ComboboxState',
            data: [
                [
                    'AL',
                    'Alabama'
                ]
            ]
            ,fields: ['state', 'name' ]
        }, cfg)]);
    }
});

JsFiddle to try: http://jsfiddle.net/voidmain/hKwbJ/

VoidMain
  • 1,987
  • 20
  • 22