PDA

View Full Version : connection request question



alex_aam
14 Nov 2007, 1:55 PM
Hello i am new to Ext JS and i want to make a question related to the response object parameter in the request method of the connection object:
I have a grid with a button which, when pressed call a webservice that insert a new record in a sql table. The webservice returns the inserted record and i am interested specialy in the key of the record that it returns.
the problem is i dont know how to get the values of the fields in the response object (in the conex.request line) to build a record to insert in the grid.
the code where is the button is:




<DIV>

var gridHead = grid.getView().getHeaderPanel(true);
var tb = new Ext.Toolbar(gridHead,
[{
text: 'Nuevo registro',
handler : function()
{
var p = new personas
({
au_id: ' ',
nombre: ' ',
edad: 1
});
grid.stopEditing();

var conex=new Ext.data.Connection();
conex.request({url:address+'/webservice2/service2.asmx/insert3',params:{au_id:0,nombre:' ',edad:1}
,success:function(response,options)
{
/*
var view=Ext.decode(response.responseText);
p= new personas
({
au_id: view.au_id,
nombre: view.nombre,
edad: view.edad
});
*/
p=Ext.decode(response.responseText);
ds.insert(0, p);
grid.startEditing(0, 0);
}
});


}
}
,{
text: 'Borrar',
handler:function()
{
borrar();
}
}
,{
text: 'Grabar',
handler:function(){
actualizar();
}
}

]); // fin toolbar

</div>


Thanks.