简体   繁体   中英

Get actual data from ext.data.store

I have this data store

 mystore= Ext.create('Ext.data.Store', {
        id: _id.boxesComboStore,
        fields: ['label', 'value', 'id', 'type'],
        autoLoad: true,
        proxy: {
            type: 'ajax',
            url: 'url/to/controller',
            reader: {
                type: 'json',
                root: 'MyModel'
            }
        }
})

How can I easily access the actual data in the store? For example the third record, actual value of type if I have more than one record in the store

If you want the third record, one way to get the data is by using getAt(id) :

var store = Ext.getStore('StoreId');
var record = store.getAt(2).data
var type = record.type;

In order for Ext.getStore(name) to work, you must define a storeId for your store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM