-
Difference between Ext.data.HttpProxy and Ext.data.DirectProxy in post data
Difference between Ext.data.HttpProxy and Ext.data.DirectProxy in post data
I have a grid bound to a store very similar to the restful grid sample http://www.extjs.com/deploy/dev/exam...l/restful.html
My DataStore is a Ext.data.DirectStore instead of a Ext.data.Store
When adding a new item to the grid, the post data sent to the server has a different format depending on the type of store used.
With Ext.data.Store -->
{"data":{"first":"abe","last":"smith","email":"test@test.com"}}
With Ext.data.DirectStore -->
{"data":["data":{"first":"abe","last":"smith","email":"test@test.com"}]}
Is this by design or a bug? If it's not a bug, can someone explain the reason for the different formatting
The funny part is that the 2nd data attribute comes from the reader root attribute and the first one seams to be a default root value....
I guess the difference comes form the type of proxy used, but I just can't nail this one.
Here is my code
var writer = new Ext.data.JsonWriter({
encode: false
});
var store = new Ext.data.DirectStore({
api: {
read: configuration_appconfig.getAppConfig,
create: configuration_appconfig.addConfig,
update: configuration_appconfig.updateConfig,
destroy: configuration_appconfig.removeConfig
},
autoLoad: true,
paramAsHash: true,
restful: true,
autoSave: true,
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
fields: [
{ name: 'id' },
{ name: 'key', type: 'string', allowBlank: false },
{ name: 'value', type: 'string', allowBlank: true }
],
writer: writer
});
Any advice?
Thanks you for your help
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us