okfn/recline — pull request #372 by kielni (2013-09-06 18:44:57+00:00)
Title: add method to replace a filter

I've added a replaceFilter method. I'm using it when I want to change the value of the filter and re-run a query. If you do a remove and then an add, you get two change events, and two re-queries; I want just one.

An example of how I'm using it is with a Leaflet map; when the user zooms or moves the map, the bounding box changes so I want to redo a query. Everything about the query is the same except for the bounding box, so I do this:

this.model.queryState.replaceFilter({
type: "geo_bounding_box",
field: "location.coord",
top_left: { "lat" : nw[0], "lon" : nw[1] },
bottom_right: { "lat" : se[0], "lon" : se[1] },
});