【问题标题】:Filtering gmap markers, how?过滤gmap标记,如何?
【发布时间】:2013-07-11 12:20:22
【问题描述】:

如何从 Json 文件中过滤 gmap 标记?

$(函数(){ 演示.add(函数(){ $('#map_canvas').gmap({'disableDefaultUI':false, 'callback': function() { 变种自我=这个; $.getJSON('demo.asp', 函数(数据){ $.each(data.markers, function(i, marker) { self.addMarker({ 'position': new google.maps.LatLng(marker.latitude, marker.longitude), 'bounds':true } ).click(function() { self.openInfoWindow({ 'content': marker.content }, this); }); }); }); }}); })。加载(); });

【问题讨论】:

    标签: json google-maps


    【解决方案1】:
    $(function() { 
    
                    demo.add(function() {
                        $('#map_canvas').gmap({'disableDefaultUI':false, 'callback': function() {
    
                            var self = this;
                            $.getJSON('demo.asp', function (data) {
                                $.each( data.markers, function(i, marker) {
                                if(marker!="filtered data"){
    
                                    self.addMarker({ 'position': new google.maps.LatLng(marker.latitude, marker.longitude), 'bounds':true } ).click(function() {
                                        self.openInfoWindow({ 'content': marker.content }, this);
                                 }
                                    });
                                });
                            });
                        }}); 
                    }).load();
                });
    

    你可以在那里过滤,或者在获取json数据的逻辑上过滤。

    【讨论】:

    • 如果它帮助您考虑点击您可以投票赞成或反对的复选框。
    猜你喜欢
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多