PDA

View Full Version : change $_POST when autosyncing store with cellediting plugin



RagingPixels
23 Feb 2013, 6:12 AM
Helllo,

i have a small application with an editable grid which uses the celledit plugin.
now i want to get the newly edited data via store sync to a database.
Right now i simply enabled autosyncing which correctly triggers my phpupdate script,
but an example of what i receive as the $_POST is the following :
[customers] => [{"customerNumber":"1481213","id":null}]

First thing i think is strange, that the id is null for each cell.
Secondly as i want to update the new data in the database, i would also need a rowindex.

How would i go about changing what is sent when autosyncing, or is there maybe a better way of approaching this problem?

my whole code so far can be found under:
https://github.com/BenjaminWinter/gridexample

and here is a code snippets from my store


Ext.define('App.store.Customers', { extend: 'Ext.data.Store',
model: 'App.model.Customers',
autoLoad: true,
autoSync: true,
proxy:{
type:'ajax',
api: {
create : '../server/app/create.php',
read : '../server/app/readJSON.php',
update : '../server/app/updateJSON.php',
destroy : '../server/app/destroy.php'
},
reader: {
type:'json',
root:'customers',
totalProperty:'total'
},
writer: {
type: 'json',
writeAllFields: false,
allowSingle: false,
encode: true,
root: 'customers'
}
}
});