PDA

View Full Version : Get values from a Editor Grid



Ourysso
21 Oct 2010, 3:14 AM
I have a button with a handler and when I'll click on this button I wanna get the values from a Editor Grid.
How do I do that? (get each value from each grid cell)

Thanks for the help.

cougar83
21 Oct 2010, 3:26 AM
Where do you need the grid data? The best way is to give some code fragments ...

Ourysso
21 Oct 2010, 3:33 AM
i have this grid:

var grid = new Ext.grid.EditorGridPanel({
x:20,
y:300,
id: 'grid_valores',
frame: true,
border: false,
columnLines: true,
anchor: '-20px',
enableColumnMove: false,
enableHdMenu: false,
bodyStyle: 'background-color: #F9F9F9; padding: 0px;',
autoExpandColumn: "descricao",
height:200,
clickstoEdit: 1,
store: storeCotacao,
plugins: summary,
cm: ColumnModel
});

and in other place of the code i have this button:

var botao_confirmar = {
x: 445,
y: 735,
xtype: 'button',
style: 'align: center;',
text: decode_utf8('Confirmar Cotação'),
handler: function() {

}

}
}

cougar83
21 Oct 2010, 4:23 AM
I think you have to get the store from the grid to navigate through the date. For example how many records are in the grid:



handler: function(){
alert(mygrid.getStore().getTotalCount());
}


In my example I put the button into the grid like a config option. So I have access to the grid variable ('mygrid').