PDA

View Full Version : get value of grid column on grid panle item click



nimaous
23 Jun 2012, 12:27 AM
Hi

I want to know How I can get vaule of a column in a gridpanel row by clicking on that row

sword-it
23 Jun 2012, 2:48 AM
Hi nimaous,
You should define the 'selType' config to 'cellmodel' (like - selType: 'cellmodel')of the grid while defining the grid.
Now you can handle the 'select' event of the grid. While you are using the 'selType' config to 'cellmodel', select event is fired with following arguments:
( Ext.selection.CellModel (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.CellModel) this, Ext.data.Model (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Model) record, Number (http://docs.sencha.com/ext-js/4-0/#!/api/Number) rowIndex, Number (http://docs.sencha.com/ext-js/4-0/#!/api/Number) columnIndex, Object (http://docs.sencha.com/ext-js/4-0/#!/api/Object) eOpts ).

To see what column is clicked, you need to add two configs to the grid as given below :

selType: 'cellmodel',
listeners: {
select: {
fn: function(cellModel, record, rowIndex, columnIndex, eOpts){
// give your own code.
}
}
}

Animal
23 Jun 2012, 9:23 AM
You do not have to use CellSelection.

You can just add a cellclick listener.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel-event-cellclick