1

I want to get all grid cell value, so I test the first cell with bellow code:

var array = [];
var grid = Ext.getCmp('grid');
var selection = grid.getSelectionModel().getSelection()[0];
console.log(array.push(selection)); //it returns 1

however

var grid = Ext.getCmp('grid');
var selection = grid.getSelectionModel().getSelection()[0];
console.log(selection);//returns undefined

any suggestions? thanks

Joy
  • 406
  • 4
  • 18

1 Answers1

1

To achieve this first you need to access all the columns of row and then respective cell of the columns. And after you can get all the values of respective cell.

You can get this by following code.

select: function(selModel, record, index, options){
                var ColLength = this.columns.length;
                for(var i=0; i<ColLength; i++){
                     var colName = this.getHeaderContainer().getHeaderAtIndex(i+1).dataIndex;
                    cellvalue = record.data[colName];
                    alert(cellvalue);
                }

            }

I made a fiddler for you where you check your complete flow. Fiddle

UDID
  • 2,350
  • 3
  • 16
  • 31