Created
April 25, 2011 13:22
-
-
Save scott2449/940495 to your computer and use it in GitHub Desktop.
EnhancedJsonRestStore
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
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