PDA

View Full Version : Problem with EditorGridPanel



Ourysso
7 Jan 2011, 9:53 AM
Hi Everyone. I'm here because I don't know what to do.

I Have This EditorGridPanel:



var grid_insumos = new Ext.grid.EditorGridPanel({
x: 10,
y: 75,
id: 'grid_insumos',
title: '<center>Materiais</center>',
frame: false,
border: true,
columnLines: true,
anchor: '-10px',
enableColumnMove: false,
enableHdMenu: true,
bodyStyle: 'border-color: #B5B8C8; padding: 0px;',
autoExpandColumn: "Descricao",
loadMask: true,
height: 250,
clickstoEdit: 1,
store: storeMateriais,
cm: ColumnModel,
sm: new Ext.grid.RowSelectionModel({singleSelect:true})
});
In one of the grid columns is rendered a button that open a window with some values. These values are related to the value of the selected row.

this is the grid of the new window:



var grid_valoresmediosinsumos = new Ext.grid.GridPanel({
x: 10,
y: 10,
id: 'grid_insumos',
title: '<center>Materiais</center>',
frame: false,
border: true,
columnLines: true,
anchor: '-10px',
enableColumnMove: false,
enableHdMenu: true,
bodyStyle: 'border-color: #B5B8C8; padding: 0px;',
autoExpandColumn: "Nota",
height: 250,
clickstoEdit: 1,
store: storeValoresInsumos,
cm: ColumnModel,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
listeners:{
rowdblclick: function(row, rowIndex, obj){
var valor = storeValoresInsumos.getAt(rowIndex).get('Valor_Unitario');

atualizaValor(valor,linha);

}
}
});
When the row of this grid is selected the value of the first grid is updated.

I'm using "var linha = Ext.getCmp('grid_insumos').getSelectionModel().getSelected();"

The problem is:
It works only the first time.
When I try again the error occurs: "Ext.getCmp("grid_insumos") is undefine" on the line "var linha = Ext.getCmp('grid_insumos').getSelectionModel().getSelected();"

Someone have any idea what's happening?

Thanks for the help.

Ourysso
7 Jan 2011, 10:40 AM
Don't waste your time on this post... I solved the problem.
Thanks for the help!