NewKidOnTheBlock
NewKidOnTheBlock

Reputation: 91

Get values from grid cell?

I'm trying to get the value of a certain column cell but with no luck. Here is my makeup of the grid:

 Ext.apply(this, {                
            xtype: 'grid',
            selModel: {
                mode: 'MULTI'
            },
            columnLines: true,
            store: Ext.create('TheGrid.store.GridDetail'),
            columns: [
                {text: 'FirstName', dataIndex: 'first_name', cellWrap: true, width: 75},
                {text: 'LastName', dataIndex: 'last_name', cellWrap: true, width: 100},
                {text: 'Comment', dataIndex: 'comment', cellWrap: true, flex:1, minWidth: 200},
            ],

I've tried to get the cell value by doing so:

 var grid_results = function(header_name, row) {
     var grid = Ext.ComponentQuery.query('grid=itemId=gridID]')[0];
     return grid.getStore().data.items[0].raw['FirstName'];
 };

Upvotes: 2

Views: 1790

Answers (1)

weeksdev
weeksdev

Reputation: 4355

you can use the get method to obtain the value of a specified field in the model

ie: grid.getStore().data.items[0].get('first_name')

Here is a fiddle demonstrating

Upvotes: 3

Related Questions