tubamanu
29 Jun 2010, 11:09 AM
Hi,
i'm trying to display the current location of a user using googlemaps. Getting latitude and longitude is working fine, also creating the map and center the location of the user is working.
Only adding a marker to the map is not working.
whats wrong with my code?
cf.Main = function(){return {
theMarker :false,
thePanel :false,
theMap :false,
theCurrentPosition :false,
init: function ( latitude, longitude) {
// initPosition
this.theCurrentPosition = new google.maps.LatLng( latitude,longitude );
// init Map with position centered
this.initMap();
// trying to add markter to the map
this.initMarker();
// create panel with map
this.initPanel();
},
initMap: function () {
this.theMap = new Ext.Map({
center: this.theCurrentPosition,
getLocation: true,
mapOptions: {
zoom: 10
}
});
},
initMarker: function () {
this.theMarker = new google.maps.Marker({
position: this.theCurrentPosition,
map: this.theMap.map
});
},
initPanel: function () {
this.thePanel = new Ext.Panel({
fullscreen: true,
items: [this.theMap]
});
}
};}();
i'm trying to display the current location of a user using googlemaps. Getting latitude and longitude is working fine, also creating the map and center the location of the user is working.
Only adding a marker to the map is not working.
whats wrong with my code?
cf.Main = function(){return {
theMarker :false,
thePanel :false,
theMap :false,
theCurrentPosition :false,
init: function ( latitude, longitude) {
// initPosition
this.theCurrentPosition = new google.maps.LatLng( latitude,longitude );
// init Map with position centered
this.initMap();
// trying to add markter to the map
this.initMarker();
// create panel with map
this.initPanel();
},
initMap: function () {
this.theMap = new Ext.Map({
center: this.theCurrentPosition,
getLocation: true,
mapOptions: {
zoom: 10
}
});
},
initMarker: function () {
this.theMarker = new google.maps.Marker({
position: this.theCurrentPosition,
map: this.theMap.map
});
},
initPanel: function () {
this.thePanel = new Ext.Panel({
fullscreen: true,
items: [this.theMap]
});
}
};}();