Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext JS 4 inline array store config

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/

like image 647
core Avatar asked Jun 16 '26 03:06

core


1 Answers

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.

like image 143
Latikov Dmitry Avatar answered Jun 19 '26 13:06

Latikov Dmitry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!