I have a chain of asynchronous events that i want to execute, some of them fetch
commands. I understand the basics of using dojo.Deferred
, but all of my attempts so far to add a fetch
callback have failed...
What im trying to do is 1) add a fetch call to my Deferred
object 2) have that fetch function be run, possibly with some extra arguments and 3) pass on the 'fetched' values to the next callback in the chain... Here's what i've got:
var myDeferred = new dojo.Deferred();
myDeferred.addCallback(this.myStore.fetch({query:{//some query//},
onComplete: function(items) { return items } })); //add the fetch callback? i think this is wrong...
myDeferred.addCallback(function(items) { console.log(items) }); //log the fetched items
myDeferred.callback(); //to fire