PDA

View Full Version : How push data to server of updated store ?



lpastor
3 Sep 2009, 1:11 PM
I use a store that is not bound to a form or grid.

If I edit a data directly in the store, how to push the change on the server ?

I tried several things that do not work, with firebug nothing is send to my server :




var foundItem = store_demande.findExact('id_demande', record.data.id_demande);

if (foundItem > 0) {

record.data.id_projet_demande=Ext.getCmp('id_projet').getValue();
//store_demande.save(record);
//store_demande.save();
//store_demande.commitChanges();
store_demande.updateRecord(record);
Ext.MessageBox.alert('GOOD',record.data.id_projet_demande);
}
Alert Box run well with good data.

I don't find the syntax...

My CRUD :



var proxy_demande = new Ext.data.HttpProxy({
url: 'Mysql_Call.php?table=demande&idkey=id_demande',
method: 'POST'
});

var reader_demande = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id_demande',
root: 'data'
}, [
{name: 'id_demande'},
{name: 'titre_demande', sortDir: 'ASC', sortType: 'asUCString', allowBlank: false},
{name: 'id_projet_demande'}
]);

var writer_demande = new Ext.data.JsonWriter();

var store_demande = new Ext.data.Store({
id: 'id_demande',
proxy: proxy_demande,
reader: reader_demande,
writer: writer_demande,
sortInfo:{field: 'titre_demande', direction: "ASC"}
});

lpastor
4 Sep 2009, 12:44 AM
I changed the title...