//TODO: create a listener for the "rowdblclick" event here
grid.on('rowdblclick',this.editMovie);
},
editMovie: function(grid,index,event){
var record = grid.getStore().getAt(index);
var form = new Ext.form.FormPanel({
width:700,
bodyStyle:'margin-left:10px;',
border:false,
labelWidth: 80,
defaults: {
xtype:'textfield',
width:550
},
items:[
{fieldLabel:'Nombre',id:'nombre'},
{fieldLabel:'Codigo',id:'codigo'},
//Combo {xtype:'combo',fieldLabel:'Codigo',id:'codigo',triggerAction:'all',store:[2009,2008,2007,2006]},
{fieldLabel:'Descripccion',id:'descripccion'},
{xtype:'numberfield',fieldLabel:'Precio',id:'precio'},
{fieldLabel:'Imagen',id:'imagen'}
]
});
var preview = new Ext.Panel({
width:91,
height:140,
html: '<img id="preview" />'
});
var win = new Ext.Window({
layout: 'column',
title: 'Editar Producto',
width:850,
height:250,
modal: true,
bodyStyle: 'padding:10px;background-color:#fff',
buttons: [{text:'Guardar Cambios'},{text:'Cancelar'},{text:'Eliminar Registro'}],
items: [preview,form]
});
win.show();
form.getForm().loadRecord(record);
Ext.get('preview').dom.src = record.get('img');
},
image: function(value,metadata,record){
return '<img src="'+value+'" alt="'+record.get('title')+'" />';
},
title: function(value, metadata, record){
metadata.attr = 'style="white-space:normal"';
return '<p><strong>'+value+'</strong>'
// si le quitamos comentario se agrega este texto debajo del nombre del producto</p>';
},
money: function(value){
return '$ '+value;
}
}
Ext.onReady(com.quizzpot.tutorial.GridFormTutorial.init,com.quizzpot.tutorial.GridFormTutorial);
form.getForm().submit({
url: 'submitform.php', //url donde se hará la petición
success: function(response){ //si todo resulta bien
console.debug(response);
},
failure: function(response){ //si hay algún error
console.debug('fail!');
}
});
form.getForm().submit({
url: 'submitform.php',
method: 'PUT', // <-- aqui se configura
success: function(response){
console.debug(response);
},
failure: function(response){
console.debug('fail!');
}
});
var win = new Ext.Window({
layout: 'column',
title: 'Editar Producto',
width:850,
height:250,
modal: true,
bodyStyle: 'padding:10px;background-color:#fff',
buttons: [{text:'Guardar Cambios', handler:
form.getForm().submit({
url: 'submitform.php',
success: function(response){ //si todo resulta bien
console.debug(response);
},
failure: function(response){ //si hay algún error
console.debug('fail!');
}
});
},{text:'Cancelar'},{text:'Eliminar Registro'}],
items: [preview,form]
});
win.show(); buttons: [
{
text: 'Consultar',
handler: function()//<--handler del boton consultar
{
}
},
{
text: 'Limpiar',
handler: function() //<--handler del boton limpiar
{
estEst_Form.getForm().reset();
}
}
]It looks like you're new here. If you want to get involved, click one of these buttons!
The content of this site is copyrighted by Quizzpot.com, it is prohibited to publish our tutorials on other blogs, magazines or any other media without prior permission.
Copyright © 2012 Quizzpot.
Our visitors are mostly developers and Web designers, advertise with us, you only need to contact us .