From d626fab31c1c8b01cab718eb204954848b00ec85 Mon Sep 17 00:00:00 2001 From: Dan Wilson Date: Thu, 16 May 2013 20:48:00 +0100 Subject: [PATCH] Fixes a bug in querystate handling. Fixes okfn/dataexplorer#120. --- src/model.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/model.js b/src/model.js index b6a9461a..99494134 100644 --- a/src/model.js +++ b/src/model.js @@ -16,6 +16,7 @@ my.Dataset = Backbone.Model.extend({ // ### initialize initialize: function() { + var self = this; _.bindAll(this, 'query'); this.backend = null; if (this.get('backend')) { @@ -35,8 +36,9 @@ my.Dataset = Backbone.Model.extend({ this.facets = new my.FacetList(); this.recordCount = null; this.queryState = new my.Query(); - this.queryState.bind('change', this.query); - this.queryState.bind('facet:add', this.query); + this.queryState.bind('change facet:add', function () { + self.query(); // We want to call query() without any arguments. + }); // store is what we query and save against // store will either be the backend or be a memory store if Backend fetch // tells us to use memory store