Skip to content

Instantly share code, notes, and snippets.

@scott2449
Created April 25, 2011 13:22
Show Gist options
  • Save scott2449/940495 to your computer and use it in GitHub Desktop.
Save scott2449/940495 to your computer and use it in GitHub Desktop.
EnhancedJsonRestStore
dojo.declare("custom.EnhancedJsonRestStore", dojox.data.JsonRestStore, {
"-chains-": {
constructor: "manual"
},
constructor : function(options) {
dojo.safeMixin(this,options);
this.service = dojox.rpc.JsonRest.services[options.target] || dojox.rpc.Rest(options.target, true, null, options.getRequest);
this.inherited(arguments);
}
});
//Usage
var store = new custom.EnhancedJsonRestStore({
target:"/my/target",
syncMode:true,
getRequest:{ //build request, including custom url & headers
url: targUrl,
handleAs: "json",
contentType: "application/json",
sync: true,
headers: {
"Accept" : "application/json",
"X-REMOTE-USERNAME" : "rahners"
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment