Skip to content

Instantly share code, notes, and snippets.

@aghuddleston
Created August 16, 2012 15:01
Show Gist options
  • Save aghuddleston/3370841 to your computer and use it in GitHub Desktop.
Save aghuddleston/3370841 to your computer and use it in GitHub Desktop.
Ext JS 4 Proxy that puts params in JSON format, that can be used by Stores.
Ext.define('Ext.ux.data.proxy.JsonAjaxProxy', {
extend:'Ext.data.proxy.Ajax',
alias:'proxy.jsonajax',
actionMethods : {
create: "POST",
read: "POST",
update: "POST",
destroy: "POST"
},
buildRequest:function (operation) {
var request = this.callParent(arguments);
// For documentation on jsonData see Ext.Ajax.request
request.jsonData = request.params;
request.params = {};
return request;
},
/*
* @override
* Inherit docs. We don't apply any encoding here because
* all of the direct requests go out as jsonData
*/
applyEncoding: function(value){
return value;
}
});
@aghuddleston
Copy link
Author

Good to know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment