Ext JS 4 inline array store config

11,930

In store inline config you need just specify type of store. 'xtype' works only for widgets (aliases with prefix 'widget')

var storeConfig = {
    type: 'array',
    fields: [ 'company', 'price' ],
    data: [
        ['3m Co',71.72],
        ['Alcoa Inc',29.01],
        ['Boeing Co.',75.43]
    ]
};

Try to print Ext.ClassManager.maps.aliasToName in console to understand aliases.

Share:
11,930

Related videos on Youtube

Dimon Buzz
Author by

Dimon Buzz

Updated on September 15, 2022

Comments

  • Dimon Buzz
    Dimon Buzz over 1 year

    Is B) not the inline equivalent of A)?

    // A) Create store with Ext.create
    var storeInstance = Ext.create('Ext.data.ArrayStore', {
        fields: ['company', 'price'],
        data: [
            ['3m Co',71.72],
            ['Alcoa Inc',29.01],
            ['Boeing Co.',75.43]
        ]
    });
    
    // B) Inline config object for store instanced in A)
    var storeConfig = {
        xtype: 'store:array',  
        fields: [ 'company', 'price' ],
        data: [
            ['3m Co',71.72],
            ['Alcoa Inc',29.01],
            ['Boeing Co.',75.43]
        ]
    };
    

    Here's the code in a sandbox: http://jsfiddle.net/cFD9W/1/