icebergdelphi
15 Jul 2012, 6:02 PM
Hi all. i´m testing extjs 4.1.1, but i found 1 bug, i just work with MVC architecture, i have my PHP file for Create new records(File create.php), my Model and my store, but when i make insert or create a new record, and then i click my save button, Extjs 4.1.1 does not save nothing. But when i'm testing with extjs 4.0.7 all works fine.
So what is really happens with the new version?
i miss something?
Note: Everything works perfectly fine if I work with ExtJS version 4.0.7, with version 4.1.1 in the firebug shows me no trace of anything.
Thanks.
here my code:
index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="eng">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PREP Candidatura Bulmaro Castillejos Calvo</title>
<link rel="stylesheet" type="text/css" href="/ext-4.1.1/resources/css/ext-all.css" />
<!-- Iconos del Sistema -->
<link rel="stylesheet" type="text/css" href="/Prep/resources/css/Prep.css" />
<!-- En las lineas siguientes, para cuando se esta desarrollando se pone:ext-all-dev.js, en produccion ext-all.js-->
<!-- No olviden cambiar el Nombre de la Carpeta Extjs4, tal como la tienen en su equipo en mi caso: Yo la tengo nombrada como ext-4.1.0 -->
<script type="text/javascript" src="/ext-4.1.1/ext-all.js"></script>
<!-- Archivos Js de la Aplicacion y recursos-->
<script type="text/javascript" src="/Prep/App/App.js"></script>
<!-- Traductor del Sistema-->
<script type="text/javascript" src="/Prep/resources/ux/ext-lang-es.js"></script>
</head>
my update an save controller action:
ActualizarVotos: function(button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
if (values.IdPrepdetalle > 0){ //Si Hay algun Valor, entra en Modo de Actualizacion
record.set(values);
} else{ //De Lo contrario, si la accion fue para agregar, se inserta un registro
record = Ext.create('Prep.model.Voto.Voto');
record.set(values);
record.setId(0);
this.getVotoVotoStore().add(record);
}
win.close();
},
my model:
Ext.define('Prep.model.Voto.Voto', {
extend: 'Ext.data.Model',
fields: [
{ name: 'IdPrepdetalle', type: 'int'},
{ name: 'IdLocalidad', type: 'int'},
{ name: 'Localidad', type: 'string'},
{ name: 'IdMunicipios', type: 'int'},
{ name: 'Municipio', type: 'string'},
{ name: 'PanVoto', type: 'int'},
{ name: 'PriPochVoto', type: 'int'},
{ name: 'PrdPtCoalVoto', type: 'int'},
{ name: 'AlianzaVoto', type: 'int'},
{ name: 'VotoNulo', type: 'int'},
{ name: 'Sobrantes', type: 'int'},
{ name: 'IdSeccion', type: 'int'},
{ name: 'Seccion', type: 'string'},
{ name: 'IdTipoCasilla', type: 'int'},
{ name: 'Casilla', type: 'string'}
]
});
my store:
Ext.define('Prep.store.Voto.Voto', {
extend: 'Ext.data.Store',
model: 'Prep.model.Voto.Voto',//Llamamos el Modelo Antes Creado
id:'StoreVoto',
autoSync: true,//Sincronizacion con el Servidor
autoSave: true, //<--- hace las peticiones al servidor automáticamente
proxy: {
type: 'ajax',
api: { //Declaramos la API y Comienzan en estas lineas las operaciones CRUD
read : "/Prep/Php/view/Prep/PrepRead.php",
create : "/Prep/Php/view/Prep/PrepCreate.php",
update : "/Prep/Php/view/Prep/PrepUpdate.php",
destroy : "/Prep/Php/view/Prep/PrepDestroy.php"
},
actionMethods:{ //Esta Linea es necesaria para que funcione el SearchField
read:'POST'
},
reader: {
type: 'json',
idProperty: 'IdPrepdetalle',
successProperty : function(response,options)
{
},
root:'data' //Json_encode root:Datos del Servidor desde desde TCD.php
},
writer:{
encode: true,
writeAllFields: true,//decide si se manda al servidor solamente los campos modificados o todo
type: 'json',
root: 'data'
},
//Mensajes Extras si deseas agregarlos
afterRequest: function (request, success)
{
if (request.action == 'read')
{
//Ext.Msg.alert('Title','Read');
}
else
if (request.action == 'update')
{
/*var jsonMsg = Ext.JSON.decode(request.operation.response.responseText);
var vMsg=jsonMsg.msg; //msg :viene del Archivo PHP
Ext.Msg.alert('Actualizacion',vMsg);*/
}
},
listeners: {
exception: function(proxy, response, operation){
Ext.MessageBox.show({
title: 'ERROR',
msg: operation.getError(),
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
},
}
}
});
So what is really happens with the new version?
i miss something?
Note: Everything works perfectly fine if I work with ExtJS version 4.0.7, with version 4.1.1 in the firebug shows me no trace of anything.
Thanks.
here my code:
index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="eng">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PREP Candidatura Bulmaro Castillejos Calvo</title>
<link rel="stylesheet" type="text/css" href="/ext-4.1.1/resources/css/ext-all.css" />
<!-- Iconos del Sistema -->
<link rel="stylesheet" type="text/css" href="/Prep/resources/css/Prep.css" />
<!-- En las lineas siguientes, para cuando se esta desarrollando se pone:ext-all-dev.js, en produccion ext-all.js-->
<!-- No olviden cambiar el Nombre de la Carpeta Extjs4, tal como la tienen en su equipo en mi caso: Yo la tengo nombrada como ext-4.1.0 -->
<script type="text/javascript" src="/ext-4.1.1/ext-all.js"></script>
<!-- Archivos Js de la Aplicacion y recursos-->
<script type="text/javascript" src="/Prep/App/App.js"></script>
<!-- Traductor del Sistema-->
<script type="text/javascript" src="/Prep/resources/ux/ext-lang-es.js"></script>
</head>
my update an save controller action:
ActualizarVotos: function(button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
if (values.IdPrepdetalle > 0){ //Si Hay algun Valor, entra en Modo de Actualizacion
record.set(values);
} else{ //De Lo contrario, si la accion fue para agregar, se inserta un registro
record = Ext.create('Prep.model.Voto.Voto');
record.set(values);
record.setId(0);
this.getVotoVotoStore().add(record);
}
win.close();
},
my model:
Ext.define('Prep.model.Voto.Voto', {
extend: 'Ext.data.Model',
fields: [
{ name: 'IdPrepdetalle', type: 'int'},
{ name: 'IdLocalidad', type: 'int'},
{ name: 'Localidad', type: 'string'},
{ name: 'IdMunicipios', type: 'int'},
{ name: 'Municipio', type: 'string'},
{ name: 'PanVoto', type: 'int'},
{ name: 'PriPochVoto', type: 'int'},
{ name: 'PrdPtCoalVoto', type: 'int'},
{ name: 'AlianzaVoto', type: 'int'},
{ name: 'VotoNulo', type: 'int'},
{ name: 'Sobrantes', type: 'int'},
{ name: 'IdSeccion', type: 'int'},
{ name: 'Seccion', type: 'string'},
{ name: 'IdTipoCasilla', type: 'int'},
{ name: 'Casilla', type: 'string'}
]
});
my store:
Ext.define('Prep.store.Voto.Voto', {
extend: 'Ext.data.Store',
model: 'Prep.model.Voto.Voto',//Llamamos el Modelo Antes Creado
id:'StoreVoto',
autoSync: true,//Sincronizacion con el Servidor
autoSave: true, //<--- hace las peticiones al servidor automáticamente
proxy: {
type: 'ajax',
api: { //Declaramos la API y Comienzan en estas lineas las operaciones CRUD
read : "/Prep/Php/view/Prep/PrepRead.php",
create : "/Prep/Php/view/Prep/PrepCreate.php",
update : "/Prep/Php/view/Prep/PrepUpdate.php",
destroy : "/Prep/Php/view/Prep/PrepDestroy.php"
},
actionMethods:{ //Esta Linea es necesaria para que funcione el SearchField
read:'POST'
},
reader: {
type: 'json',
idProperty: 'IdPrepdetalle',
successProperty : function(response,options)
{
},
root:'data' //Json_encode root:Datos del Servidor desde desde TCD.php
},
writer:{
encode: true,
writeAllFields: true,//decide si se manda al servidor solamente los campos modificados o todo
type: 'json',
root: 'data'
},
//Mensajes Extras si deseas agregarlos
afterRequest: function (request, success)
{
if (request.action == 'read')
{
//Ext.Msg.alert('Title','Read');
}
else
if (request.action == 'update')
{
/*var jsonMsg = Ext.JSON.decode(request.operation.response.responseText);
var vMsg=jsonMsg.msg; //msg :viene del Archivo PHP
Ext.Msg.alert('Actualizacion',vMsg);*/
}
},
listeners: {
exception: function(proxy, response, operation){
Ext.MessageBox.show({
title: 'ERROR',
msg: operation.getError(),
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
},
}
}
});