0
votes

I have a GridPanel in EXTJS4 with JSONstore. Like this:

var storeGridSpe = Ext.create('Ext.data.JsonStore',{            
        proxy: {
                type: 'ajax',
                url: 'get-data-for-gridspe.php',
                reader: {
                    type: 'json',
                    root: 'rows',
                    totalProperty: 'totalCount'            
                }
            },          
            autoDestroy: true,
            fields: [
                 {name: 'specie'},
                 {name: 'conta'}
            ]
        });       

var GridSpe = Ext.create('Ext.grid.GridPanel',{
            store: storeGridSpe,
            id: 'gridspe',
            flex:1,
            autoScroll: true,
            columns: [         
                {id:'specie', header: "Specie", dataIndex: 'specie', flex:1},
                {id:'conta', header: "Selezioni", dataIndex: 'conta', width:75}
            ]       
        });  

How can I get a value of the first GridPanel record? For example column "specie".

Thank you very much.

2

2 Answers

1
votes

This should work: storeGridSpe.first().get('specie')

ExtJS4 has changed model querying a bit, so you may need to a tweak to get this to work exactly right.

Here's Ext.data.Store, which pointed me to the first() method, and here's Ext.data.Model, which indicated get() as the method to use.

4.0.x is still pretty volatile, so nothing or everything may work. :P

0
votes

Depending on how you are loading things up, you might need to wait until the grid's store's proxy has finished loading data e.g.

storeGridSpe.on('load',reactorFunction);