Skip to content

Instantly share code, notes, and snippets.

@Munter
Created August 9, 2010 15:31
Show Gist options
  • Save Munter/515576 to your computer and use it in GitHub Desktop.
Save Munter/515576 to your computer and use it in GitHub Desktop.
function test() {
var rec = Ext.data.Record.create([
{name: 'id', type: 'string'}
]);
var store = new Ext.data.JsonStore({
autoSave: true,
proxy: new Ext.data.HttpProxy({
url: 'test',
defaultHeaders: {
'Content-Type': 'application/json; charset=UTF-8'
},
method: 'POST'
}),
reader: new Ext.data.JsonReader(
{
idProperty: 'id',
root: 'result',
successProperty: 'success'
},
rec
),
writer: new Ext.data.JsonWriter({
encode: false,
encodeDelete: true,
writeAllFields: true
})
});
store.add(
new rec({
id: 'myId'
})
);
};
// ExtJS 3.2.x POST data: {"undefined":{"id":"myId"}}
// ExtJS 3.3.x POST data: {"undefined":[{"id":"myId"},{"id":"myId"}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment