Closed fourlincoln10 closed 12 years ago
You can. Since Backbone is already present on the page, you can just hook into vs.app.searchQuery's events: [add, remove].
On the demo.html page, try adding the following: window.visualSearch.searchQuery.bind('add', function() { console.log(['Added', arguments]); })
Additionally, you could serialize the facet and stick it into pushState call in the search callback:
callbacks : {
search : function(query, searchCollection) {
console.log(["query", searchCollection.facets(), query]);
}
}
You can then set the value with:
window.visualSearch.searchBox.value("Hello: world")
It would be nice if there was any easy way to push facets and their values into the browser history using pushState and then pop them off again and recreate all of the facets/values and rerun the search when the user hits the back button.