Skip to content

Instantly share code, notes, and snippets.

@mjgallag
Last active October 11, 2015 06:08
Show Gist options
  • Select an option

  • Save mjgallag/3814876 to your computer and use it in GitHub Desktop.

Select an option

Save mjgallag/3814876 to your computer and use it in GitHub Desktop.
Sencha Touch/Ext JS Force.com Remote Action Proxy
Ext.define('Force.proxy.RemoteAction', {
extend: 'Ext.data.proxy.Direct',
alias: 'proxy.remoteaction',
requires: ['Ext.direct.RemotingMethod'],
updateDirectFn: function(directFn) {
directFn.directCfg.method.getArgs = Ext.create('Ext.direct.RemotingMethod').getArgs;
directFn.directCfg.method.getLen = function() {return this.len;};
directFn.directCfg.method.getOrdered = function() {return true;};
},
createRequestCallback: function(request, operation, callback, scope) {
var me = this;
return function(data, event) {
event.getMessage = function() {return this.message;};
event.getResult = function() {return this.result;};
event.getStatus = function() {return this.status;};
event.result = data;
me.processResponse(event.getStatus(), operation, request, event, callback, scope);
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment