Merge pull request #373 from kielni/override_handleQueryResult

[model][s]: various improvements around query building (add/remove facets) and allowing overriding of handling query result.
This commit is contained in:
Rufus Pollock 2013-10-13 02:28:55 -07:00
commit 98e8647e16

View File

@ -43,6 +43,10 @@ my.Dataset = Backbone.Model.extend({
// store will either be the backend or be a memory store if Backend fetch
// tells us to use memory store
this._store = this.backend;
// if backend has a handleQueryResultFunction, use that
this._handleResult = (this.backend != null && _.has(this.backend, 'handleQueryResult')) ?
this.backend.handleQueryResult : this._handleQueryResult;
if (this.backend == recline.Backend.Memory) {
this.fetch();
}
@ -189,7 +193,7 @@ my.Dataset = Backbone.Model.extend({
this._store.query(actualQuery, this.toJSON())
.done(function(queryResult) {
self._handleQueryResult(queryResult);
self._handleResult(queryResult);
self.trigger('query:done');
dfd.resolve(self.records);
})