I think you will have to redefine the fetch model to make it work
See what the default selection looks like:
fetch: function(options) { options = _.extend({parse: true}, options); var model = this; var success = options.success; options.success = function(resp) { var serverAttrs = options.parse ? model.parse(resp, options) : resp; if (!model.set(serverAttrs, options)) return false; if (success) success.call(options.context, model, resp, options); model.trigger('sync', model, resp, options); }; wrapError(this, options); return this.sync('read', this, options); },
( github )
This implementation does not support the asynchronous version of model.parse , but since you are creating a model class using .extend , you can override this with your own implementation, so let's see what it does. It takes options objects, creates a success callback, and then passes it to Backbone.Sync .
This is the call that parse calls and what needs to be done to support async.
The quickest and most dirty way to do this is probably to simply copy and modify an existing default selection.
var MyModel = Backbone.Model.extend({ fetch: function(options) { options = _.extend({parse: true}, options); var model = this; var success = options.success; options.success = function(resp) { function parser(resp, options, cb) { ...do your async request stuff and call cb with the result when done... } parser(resp, options, function(result) { if (!model.set(result, options)) return false; if (success) success.call(options.context, model, resp, options); model.trigger('sync', model, resp, options); }); }; wrapError(this, options); return this.sync('read', this, options); } });
This is just an example of how you can solve this. I have not tested it, and it may not work, but I see no obvious reasons why this should not be.