Hi, i have a formPanel and load data in that one, now i want update data and doesn't works, i'm use firebug but doesn't show errors, here my code:
Ext.onReady(function(){
Ext.QuickTips.init();
var actualizar = function() {
var s=tabs.form.submit({
failure: function() {
Ext.MessageBox.alert('Status', 'Error');
},
success: function() {
Ext.MessageBox.alert('Status', 'Success');
}
});
};
Ext.form.Field.prototype.msgTarget = 'side';
var bd = Ext.getBody();
var tabs = new Ext.FormPanel({
labelWidth: 100,
url:'http://localhost/prueba/Proyecto_Ext/actualizar.php',
method: 'POST',
title: 'Agregar Usuario',
border:false,
autoHeigth: true,
width: 500,
reader: new Ext.data.JsonReader({
root: 'root',
totalProperty: 'total',
id: 'id'
},[
{name: 'id', mapping: 'id', type: 'int'},
{name: 'cedula', mapping: 'cedula', type: 'string'},
{name: 'nombre', mapping: 'nombre', type: 'string'},
{name: 'apellido', mapping: 'apellido', type: 'string'},
{name: 'id2', mapping: 'id2', type: 'int'},
{name: 'empresa', mapping: 'empresa', type: 'string'},
{name: 'direccion', mapping: 'direccion', type: 'string'},
{name: 'telefono', mapping: 'telefono', type: 'string'}
]),
items: {
xtype:'tabpanel',
activeTab: 0,
deferredRender: false,
layoutOnTabChange:true,
defaults:{autoHeight:true, bodyStyle:'padding:10px'},
items:[{
title:'Datos Personales',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Cedula',
name: 'cedula', Ext: Help [Archive] - Page 18 - Ext JS Forums:: EditorGrid: Update ENTIRE Row event. How to freeze a column in a grid, and prevent hide? Multiple data-sources --> 1 grid? documentation for FormPanel? http://extjs.com/forum/archive/index.php/f-9-p-18.htmlHOME |
allowBlank:false
},{
fieldLabel: 'Nombre',
name: 'nombre'
},{
fieldLabel: 'Apellido',
name: 'apellido'
}]
},{
title:'Datos Laborales',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Empresa',
name: 'empresa'
},{
fieldLabel: 'Direccion',
name: 'direccion'
},{
fieldLabel: 'Telefono',
name: 'telefono'
}]
},{
title:'Dirección de Habitación',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Pais',
name: 'pais'
},{
fieldLabel: 'Estado',
name: 'estado'
},{
fieldLabel: 'Cod. Postal',
name: 'postal'
},{
fieldLabel: 'Ciudad',
name: 'ciudad'
},{
fieldLabel: 'Urbanizacion',
name: 'urbanizacion'
},{
fieldLabel: 'Calle',
name: 'calle'
},{
fieldLabel: 'Casa',
name: 'casa'
},{
fieldLabel: 'No Casa/Apto',
name: 'numcasa'
}]
},{
title:'Numero de Telefonos',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Celular',
name: 'celular'
},{
fieldLabel: 'Habitacion',
name: 'habitacion'
},{
fieldLabel: 'Trabajo', Ext: Help [Archive] - Page 53 - Ext JS Forums:: Update Grid by refreshing store without data. treepanel adn IE incompatibilty Get combobox instance from a FormPanel. recup data from Json. Combo Box SetValue http://extjs.com/forum/archive/index.php/f-9-p-53.htmlHOME |
name: 'trabajo'
},{
fieldLabel: 'Contacto',
name: 'contacto'
}]
}]
},
buttons: [{
text: 'Save'
handler: actualizar
},{
text: 'Cancel'
}]
});
tabs.render(document.body);
tabs.form.load({url:'http://localhost/prueba/Proyecto_Ext/cargar.php', method:'POST'});
});
please help me!!!:((
Don't use a Reader. It understands Json already.
Animal i did it your tips and doesn't work, here my code:
Ext.onReady(function(){
Ext.QuickTips.init();
var actualizar = function() {
var s=tabs.form.submit({
/*url:'http://localhost/prueba/Proyecto_Ext/actualizar.php',
method: 'POST',*/
failure: function() {
Ext.MessageBox.alert('Status', 'Error');
},
success: function() {
Ext.MessageBox.alert('Status', 'Success');
}
});
};
Ext.form.Field.prototype.msgTarget = 'side';
var bd = Ext.getBody();
var tabs = new Ext.FormPanel({
labelWidth: 100,
url:'http://localhost/prueba/Proyecto_Ext/actualizar.php',
method: 'POST',
title: 'Agregar Usuario',
border:false,
autoHeigth: true,
width: 500,
/*reader: new Ext.data.JsonReader({
root: 'root',
totalProperty: 'total',
id: 'id'
},[
{name: 'id', mapping: 'id', type: 'int'},
{name: 'cedula', mapping: 'cedula', type: 'string'},
{name: 'nombre', mapping: 'nombre', type: 'string'},
{name: 'apellido', mapping: 'apellido', type: 'string'},
{name: 'id2', mapping: 'id2', type: 'int'},
{name: 'empresa', mapping: 'empresa', type: 'string'},
{name: 'direccion', mapping: 'direccion', type: 'string'},
{name: 'telefono', mapping: 'telefono', type: 'string'}
]),*/
items: {
xtype:'tabpanel',
activeTab: 0,
deferredRender: false,
layoutOnTabChange:true,
defaults:{autoHeight:true, bodyStyle:'padding:10px'},
items:[{
title:'Datos Personales',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Cedula',
name: 'cedula',
allowBlank:false
},{
fieldLabel: 'Nombre',
name: 'nombre'
},{
fieldLabel: 'Apellido',
name: 'apellido'
}]
},{
title:'Datos Laborales',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Empresa',
name: 'empresa'
},{
fieldLabel: 'Direccion',
name: 'direccion'
},{
fieldLabel: 'Telefono',
name: 'telefono'
}]
},{
title:'Dirección de Habitación',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Pais',
name: 'pais'
},{
fieldLabel: 'Estado',
name: 'estado'
},{
fieldLabel: 'Cod. Postal',
name: 'postal'
},{
fieldLabel: 'Ciudad',
name: 'ciudad'
},{
fieldLabel: 'Urbanizacion',
name: 'urbanizacion'
},{
fieldLabel: 'Calle',
name: 'calle'
},{
fieldLabel: 'Casa',
name: 'casa'
},{
fieldLabel: 'No Casa/Apto',
name: 'numcasa'
}]
},{
title:'Numero de Telefonos',
layout:'form',
defaults: {width: 270},
defaultType: 'textfield',
items: [{
fieldLabel: 'Celular',
name: 'celular'
},{
fieldLabel: 'Habitacion',
name: 'habitacion'
},{
fieldLabel: 'Trabajo',
name: 'trabajo'
},{
fieldLabel: 'Contacto',
name: 'contacto'
}]
}]
},
buttons: [{
text: 'Save',
handler: actualizar
},{
text: 'Cancel'
}]
});
tabs.render(document.body);
tabs.form.load({url:'http://localhost/prueba/Proyecto_Ext/cargar.php', method:'POST'});
});
Load data but not send for update
1) Load data into formpanel for edit
2) Edit data into form
3) Send back data to server for update record
Nortel Unveils Vision, Strategy for Israeli High-Performance Net
Busy Friday Leads to Strong Close for Net Stocks
|