wallynm
22 Nov 2011, 5:21 AM
Hey guys, i'm trying to update an grid, which form is inside an window. Here's my controller code which send the Ajax request:
updateUser: function(button) {
var win = button.up('window');
var form = win.down('form');
var record = form.getRecord();
var values = form.getValues();
console.error(record, values)
record.set(values);
win.close();
this.getTarefasTesteStore().sync()
}
Well, my problem here, it's because, .sync() send an ajax request, but i don't know how to get the data on the server, my store:
Ext.define('taskmag.store.TarefasTeste', { extend: 'Ext.data.Store',
model: 'taskmag.model.Tarefas',
autoLoad: true,
//autoSync: true,
pageSize: 20,
proxy: {
method: 'POST',
type: 'ajax',
actionMethods: {read : 'POST'},
api: {
read: baseurl+'tarefas/listagem',
update: baseurl+'tarefas/update'
},
reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
}
});
I could pass all the data inside my form to the update URL?
How i would pass it as POST data?
My ajax send has an request payload, which is the row edited, i would like to get this data as post data...
Query String
_dc: 1321966762541
Request Payload
{"codtarefa":"4","nometarefa":"Cadastro de sistema","codcriador":"1","codresponsavel":"1","datainicio":"11/26/2011","datacriacao":"11/26/2011","datafinalizacao":"11/26/2011","status":"4"}
updateUser: function(button) {
var win = button.up('window');
var form = win.down('form');
var record = form.getRecord();
var values = form.getValues();
console.error(record, values)
record.set(values);
win.close();
this.getTarefasTesteStore().sync()
}
Well, my problem here, it's because, .sync() send an ajax request, but i don't know how to get the data on the server, my store:
Ext.define('taskmag.store.TarefasTeste', { extend: 'Ext.data.Store',
model: 'taskmag.model.Tarefas',
autoLoad: true,
//autoSync: true,
pageSize: 20,
proxy: {
method: 'POST',
type: 'ajax',
actionMethods: {read : 'POST'},
api: {
read: baseurl+'tarefas/listagem',
update: baseurl+'tarefas/update'
},
reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
}
});
I could pass all the data inside my form to the update URL?
How i would pass it as POST data?
My ajax send has an request payload, which is the row edited, i would like to get this data as post data...
Query String
_dc: 1321966762541
Request Payload
{"codtarefa":"4","nometarefa":"Cadastro de sistema","codcriador":"1","codresponsavel":"1","datainicio":"11/26/2011","datacriacao":"11/26/2011","datafinalizacao":"11/26/2011","status":"4"}