Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps Sencha touch-无法谷歌地图标记_Google Maps_Extjs_Sencha Touch - Fatal编程技术网

Google maps Sencha touch-无法谷歌地图标记

Google maps Sencha touch-无法谷歌地图标记,google-maps,extjs,sencha-touch,Google Maps,Extjs,Sencha Touch,我正在学习SenchaTouch,并尝试在谷歌地图上放置标记。我已经在网上查看了大多数示例,但是我无法让marker和infoWindow正常工作。下面是我的代码: myApp.views.MapCard = Ext.extend(Ext.Panel, { id: "mapcard", layout: 'card', initComponent: function() { this.map = new Ext.Map({ useCu

我正在学习SenchaTouch,并尝试在谷歌地图上放置标记。我已经在网上查看了大多数示例,但是我无法让marker和infoWindow正常工作。下面是我的代码:

myApp.views.MapCard = Ext.extend(Ext.Panel, {
    id: "mapcard",
    layout: 'card',
    initComponent: function() {
        this.map = new Ext.Map({
            useCurrentLocation: true,
            mapOptions: {
                zoom: 12,
            },
        });

        this.panel = new Ext.Panel({
            layout: 'fit',
            items: this.map,
        });

        this.items = this.panel;

        myApp.views.MapCard.superclass.initComponent.call(this);

        refresh = function(theMap) {
            var geoTag = {
                lat: '47.584863',
                longi: '-122.147026',
                text: 'Hello World',
            }
            addMarker(geoTag, theMap);
        }

        addMarker = function(geoTag, theMap) {
            var latLng = new google.maps.LatLng(geoTag.lat, geoTag.longi);
            var marker = new google.maps.Marker({
                map: theMap.map,
                position: latLng
            });

            google.maps.event.addListener(marker, "click", function() {
                geoTagBubble.setContent(tweet.text);
                geoTagBubble.open(theMap.map, marker);
            });
        };

        geoTagBubble = new google.maps.InfoWindow();

        refresh(this.map);
    },

});

Ext.reg('mapcard', myApp.views.MapCard);
我也无法获取用户的当前位置,我非常确定在初始化组件期间没有加载映射。我将调用一个json服务来拉取lat/lon并稍后循环。如果有更好的实现,请让我知道


非常感谢

下面是一个非常简单的示例应用程序,演示了这一点:

您可以在view source下或GitHub上找到源代码:

以下是将标记添加到地图的面板:

警告:Sencha Touch 1.x中存在一个阻止嵌入式谷歌地图接收任何点击事件的漏洞

在包含sencha-touch.js之后,您需要包含此修补程序,以便地图上的任何单击侦听器都可以工作: