For anyone else that might be looking into this. To handle Async calls you will have to do that request in makeRequest method of your custom adapter. As you can see defferred is passed in.
If you look at manager.js code you will see that executeQuery checks if adaptor has `makeRequest` defined and if so it calls it with `
(result, deffered, args, query)`if (!this.dataSource.offline && (this.dataSource.url !== undefined && this.dataSource.url !== '')
|| (!isNullOrUndefined(this.adaptor[makeRequest]))) {
var result = this.adaptor.processQuery(this, query);
if (!isNullOrUndefined(this.adaptor[makeRequest])) {
this.adaptor[makeRequest](result, deffered, args, query);
}
else if (!isNullOrUndefined(result.url)) {
this.makeRequest(result, deffered, args, query);
}
else {
args = DataManager.getDeferedArgs(query, result, args);
deffered.resolve(args);
}
}
else {
DataManager.nextTick(function () {
var res = _this.executeLocal(query);
args = DataManager.getDeferedArgs(query, res, args);
deffered.resolve(args);
});
}
if (done || fail) {
deffered.promise.then(done, fail);
}
if (always) {
deffered.promise.then(always, always);
}
return deffered.promise;