I have a meteor app that I’m working on that display a map of business locations. The map has a an observe helper added in order to update itself reactively when business locations are added, deleted or changed in the collection.
Sites.find().observe({
added: function(document) { ...
I also have a list of those locations (sites) in a table displayed underneath the map area and a list of “filters” (checkboxes) that allows the user to filter which businesses to view in the list / map. The filters set session variables that the list uses to update itself:
Template.theSites.helpers({
sites: function() {
// return Sites.find ({
// return Sites.find({ "project": {$in: ["Home Depot POS", "Beer Shop POS Install"]}}, {
var projectList = Session.get("projectList")
if (projectList == null) {
projectList = [];
}
if (sitesToShow == "problemSitesOnly") {
return Sites.find({ "project": {$in: projectList}, "client": {$in: clientList}, "siteStatus": {$in: ["2"]} }, {
sort: {
siteStatus: -1
}
});
My question is how can I get the map area to look at the session variables to update itself instead of using the .observe callback?