I’m using Dojo JsonREST store to communicate with a RESTful API on the server. The GET and QUERY methods work very well, with asynchronous callback handlers. The PUT request to post new object on the JsonREST store however doesn’t seem to have asynchronous callback capabilities. It is then impossible to fire an event only if the PUT request was done and was a success.
From the documentation (http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html) :
require(["dojo/store/JsonRest"], function(JsonRestStore){
var store = new JsonRestStore({target: "/Table/" });
store.get(3).then(function(object){
// CALLBACK HERE :-)
});
store.query("foo=bar").then(function(results){
// CALLBACK HERE :-)
});
store.put({ foo: "bar" }, { id: 3 }); // NO CALLBACK CAPABILITIES ???
store.remove(3); // NO CALLBACK CAPABILITIES ???
});
Any ideas ?
Thanks
Have you tried using
store.put({ foo: "bar" }, { id: 3 }).then(function(){});,store.remove(3).then(function(){});? Check these docs and this post.