Created
December 11, 2014 09:09
-
-
Save rusco/8815e8e67d84491b786e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Ext.JsonAjax.js: Proxy to make Ext.js 4 AjaxProxy ASP.Net Webservices compatible | |
// | |
// Example: var myStore = Ext.create('Ext.data.Store', { | |
// model: 'someModel', | |
// id: 'someId', | |
// proxy: { | |
// type: 'jsonajax', | |
// url: someUrl, | |
// extraParams: {"param1":"someParam"}, | |
// }, | |
// autoLoad: true | |
// }); | |
// | |
Ext.define('Ext.ux.data.proxy.JsonAjaxProxy', { | |
extend: 'Ext.data.proxy.Ajax', | |
alias: 'proxy.jsonajax', // type: 'jsonajax' | |
actionMethods: { | |
create: "POST", read: "POST", update: "POST", destroy: "POST" | |
}, | |
filterParam: undefined, | |
pageParam: undefined, | |
startParam: undefined, | |
limitParam: undefined, | |
headers: { | |
'Content-Type': 'application/json; charset=utf-8' | |
}, | |
buildRequest: function (operation) { | |
var request = this.callParent(arguments); | |
request.jsonData = request.params;// For documentation on jsonData see Ext.Ajax.request | |
request.params = {}; | |
return request; | |
}, | |
reader: { | |
type: 'json', | |
root: 'd', //.NET 4 root = d | |
successProperty: 'success' | |
}, | |
applyEncoding: function (value) { | |
return value; | |
}, | |
noCache: false | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment