在Meteor应用程序中过滤传单标记

在Meteor应用程序中过滤传单标记,meteor,leaflet,Meteor,Leaflet,我允许用户通过从复选框列表中选择类别来显示和隐藏传单地图中的标记 var createMarkers = function () { var markers = new L.LayerGroup({}); Locations.find().forEach(function (location) { var lat, lng, category, popup lat = location.lat; lng = location.l

我允许用户通过从复选框列表中选择类别来显示和隐藏传单地图中的标记

var createMarkers = function () {

    var markers = new L.LayerGroup({});

    Locations.find().forEach(function (location) {
        var lat, lng, category, popup
        lat = location.lat;
        lng = location.lng;
        category = location.category

        popup = "location.name + location.category;

        return markers.addLayer(new L.marker([lat, lng], {
          icon: icon
        }).bindPopup(popup));

        }
    })
}


Meteor.subscribe('locations', createMarkers);
我有一个基于复选框选择返回类别数组的会话,但不确定基于此更新客户端上标记的最佳方法


我也考虑过使用传单.GroupedLayerControl插件,但不确定这是否是一个更好的方法

我从来没用过传单,但我想你们可能打错电话了?谢谢可以使用一些重构tbh,但主层目前运行良好,无需任何过滤。我目前正在研究实现过滤UI的方法,以及这是否最好通过会话来实现,或者是否有更好的方法来处理。