PDA

View Full Version : How to send value to a cell in EditorGridPanel ?



ramkira
27 Jan 2010, 8:41 AM
Hello everyone, I am very happy to give me a hand with this problem :( . I have a EditorGridPanel with data loaded, but I change the column "price" and the change must calculate a value amount and send to cell "total."

Here is code I use for those functions not only as sending the total to the total cell in the same row where I am.

Also an image. I hope I can help. Thank you. :)




var SimpleColumnModelo = new Ext.grid.ColumnModel(
[
{
header: 'Nro Guia',
readOnly: true,
dataIndex: 'gui_rmt',
width: 30,
hidden: false
},
{
header: 'Descripcion',
dataIndex: 'dsc_mcd',
readOnly: true,
width: 70

},
{
header: 'Cantidad',
dataIndex: 'cantidad',
editor: new Ext.form.NumberField(
{
allowBlank: false,
listeners: {
blur: function(){
var m = Ext.getCmp('guias_fac').getSelectionModel().getSelections();
var cantidad = m[0].get("cantidad");
var flet = m[0].get("flt_uni");
var n_import = cantidad * flet;
}
}
}),
decimalSeparator : ',',
allowDecimals: true,
allowNegative: false,
style: 'text-align: right',
width: 40
},
{
header: 'Uni. Med',
dataIndex: 'uni_med',
width: 40
},
{
header: 'Flete',
dataIndex: 'flt_uni',
style: 'text-align: right',
allowBlank: false,
editor: new Ext.form.NumberField({
allowBlank: false,
listeners: {
blur: function(){
var m = Ext.getCmp('guias_fac').getSelectionModel().getSelections();
var cantidad = m[0].get("cantidad");
var flet = m[0].get("flt_uni");
var n_import = cantidad * flet;
//alert(n_import);
}
}
}),
decimalSeparator : ',',
allowDecimals: true,
allowNegative: false,
width: 40
},
{
header: 'Total', // Here send total
dataIndex: 'importe',
style: 'text-align: right',
editor: new Ext.form.NumberField({allowBlank: false}),
width: 40
}
]
);