bryan10
5 Jan 2012, 11:51 PM
I have set Data writer writeAllFields config to false for an
Update request (so that only modified form fields are sent to
server - but all fields are being sent.
The model is configured as below.
I then load a record into a form from a grid using:
loadRecord(sel.getSelection()[0]);
I then modify a field in the form.
I then use the following to retrieve the form record and send
update request to server:
var rec = this.up('form').getRecord();
rec.save({
success: function() { ... }
})
The request is sent but all fields are sent not just the modified
field?
Thank you in advance,
bryan
var newWriter = Ext.create('Ext.data.writer.Json',{
writeAllFields: false
})
Ext.define('BILL.model.Band', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'long'},
{name: 'band', type: 'long'},
... // more fields
],
proxy: {
type: 'ajax',
api: {
update: '/updateband'
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success',
messageProperty: 'msg'
},
writer: newWriter
},
belongsTo: '...'
});
request payload
{"id":669,"band":"3",...extra fields...}
response I send
{ success: true, data: [{"id":669}]}
Update request (so that only modified form fields are sent to
server - but all fields are being sent.
The model is configured as below.
I then load a record into a form from a grid using:
loadRecord(sel.getSelection()[0]);
I then modify a field in the form.
I then use the following to retrieve the form record and send
update request to server:
var rec = this.up('form').getRecord();
rec.save({
success: function() { ... }
})
The request is sent but all fields are sent not just the modified
field?
Thank you in advance,
bryan
var newWriter = Ext.create('Ext.data.writer.Json',{
writeAllFields: false
})
Ext.define('BILL.model.Band', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'long'},
{name: 'band', type: 'long'},
... // more fields
],
proxy: {
type: 'ajax',
api: {
update: '/updateband'
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success',
messageProperty: 'msg'
},
writer: newWriter
},
belongsTo: '...'
});
request payload
{"id":669,"band":"3",...extra fields...}
response I send
{ success: true, data: [{"id":669}]}