我使用以下代码将标记添加到地图中,但未向我显示 Ext.map 中的标记
{
xtype: 'map',
id :'geomap',
width: '70%',
height: '100%',
layout: 'fit',
useCurrentLocation: false,
flex: 3,
mapOptions: {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl : false,
navigationControl : false,
streetViewControl : false,
backgroundColor: 'transparent',
disableDoubleClickZoom: true,
draggable: true,
keyboardShortcuts: false,
scrollwheel: true,
},
initialize: function() {
var gMap = this.getMap();
// drop map marker
var marker = new google.maps.Marker({
map: gMap,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng (12.82787,80.219722),
title:"Hello World!"
});
var geo = Ext.create('Ext.util.Geolocation', {
autoUpdate: true,
listeners: {
locationupdate: function (geo) {
var center = new google.maps.LatLng(geo.getLatitude(), geo.getLongitude());
Ext.getCmp('geomap').update(center);
//To place the marker
var marker = new google.maps.Marker({
position: center,
map: Ext.getCmp('geomap').map
});
Ext.msg.alert('New latitude: ' + geo.getLatitude());
},
locationerror: function (geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
if (bTimeout) {
Ext.msg.alert('Timeout occurred.');
} else {
Ext.msg.alert('Error occurred.');
}
}
}
});
geo.updateLocation();
}
}
没有显示标记。请帮忙 。