ilhan
ilhan

Reputation: 8961

Getting raw value of a cell of a selected row in a grid

With

console.log(grid.getSelectionModel().getSelection());

I cann see that I have selected a row and there it is all the values of the row under the raw however I was unable to read it.

I have tried

grid.getSelectionModel().getSelection().raw
grid.getSelectionModel().getSelection().raw.EMAIL

etc, didn't work.

Upvotes: 0

Views: 8102

Answers (3)

Aminesrine
Aminesrine

Reputation: 2140

{
    xtype: 'gridpanel',
    ....
    listeners: {
        select: function(selModel, record, index, options){
            alert(record.get('EMAIL'));
                }
        }

Upvotes: 0

yuli noriega
yuli noriega

Reputation: 11

Instead of

grid.getSelectionModel().getSelection()

is

grid.getSelectionModel().getSelections()

So it could be

var sel = grid.getSelectionModel().getSelections();

or

grid.getSelectionModel().getSelections()[0].get('field');

Upvotes: 1

sha
sha

Reputation: 17860

According to http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.Model-method-getSelection getSelection() returns array of Ext.data.Model.

So what you need to do is

var sel = grid.getSelectionModel().getSelection(),
    model = sel[0],
    val = model.get('EMAIL');

Upvotes: 5

Related Questions