PDA

View Full Version : Model in Store get's saved but record not updated



dewie
8 Feb 2011, 8:34 AM
Hi,

Having some trouble with getting the hang of a model with a json store:

I create a model



var record = Ext.ModelMgr.create({
type : 'SERVICE' }, 'Operation');
jsa.Stores.Operation.add(record);
record.join(jsa.Stores.Operation);
jsa.Operations.Forms.Service.load(record);



And when i save the record:



var form = jsa.Operations.Forms.Service;
var record = form.getRecord();
form.updateRecord(record, true);
record.save();


This works the record get's save with a post to /operations (params sent records[{}])

The problem i'm having that the record in the dataview store (jsa.Operations.Forms.Service) doesn't get updated
with the response from the server (it needs the id to do updates in the future)

The responses i tried are {} (hash) of the new record and [{}] and an array of the new records.

Anyone an idea of the best method to get this to work ?
Also does anyone know a basic crud example with a json store ?

martinbroos
29 Apr 2011, 3:42 AM
I'm having the same problem. When i do a save on my edited form date i get the following error :

Error: You are using a ServerProxy but have not supplied it with a url.

I submit my code with this button:



id: 'apply',
xtype: 'button',
ui: 'confirm',
text : 'Opslaan',
listeners: {
'tap': function () {
/* submit data */
this.form.updateRecord(this.record, true);
this.record.save();
}
}


My store is a TreeStore build from a JSON file. Any suggestions on doing CRUD actions with a JSON TreeStore ?