PDA

View Full Version : How to set Markers in a Map after maprender-event?



Ganitai
28 Aug 2012, 6:43 AM
Hi everyone,


I am building an application to show some markers in a coordinate system. I wanna use Google Maps to use its zoom-events and some more features. I created a few costum.map.types and its workin fine. But when I start to insert a marker in my map nothing happens. I am using the maprender-event, but nothing happens, its also the same with the painted-event. There must be a mistake in the Code but I cant see.
I would be very happy if someone could help me.


Thanks in advance!




Ext.define('App.view.FlavorMap', {


extend: 'Ext.Container',
requires: ['Ext.Map'],
//id: 'x1',
xtype: 'flavormap',


config: {
title: 'Whisky Map',
iconCls: 'maps',
layout: 'fit',

items: [
{
docked: 'top',
xtype: 'toolbar',
title: 'Whisky Map',
defaults: {
iconMask: true
}
},
{
xtype: 'map',
useCurrentLocation: false,
mapOptions: {
mapTypeIds: ['brown','blue'],
zoom: 1,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: ['brown','blue'],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
mapTypeId: 'brown',
center: new google.maps.LatLng(0,0)
}
}
],
listener: [
{
maprender: function() {
alert("Map rendered!"); //neither maprender nor painted works
}
}
]
},
});


Ext.Viewport.setStyleHtmlContent(true);
Ext.Viewport.setHtml('');

Ganitai
31 Aug 2012, 2:29 AM
Hi guys,

would be very nice if someone could take a look at my codes. Somethink is missing, but I dont really know what. The console tells me: map: undefiend.
I now use the listener show, because maprender do nothing (the custom maptypes?). but I still dont know how to add markers. This is my Code for the Marker from the controller.



flavorMapView: { show: function(){

console.log('Map component is shown');
var marker = new google.maps.Marker({
position: new google.maps.LatLng(0,0),
map: google.maps.x1
});
console.log(marker);
}
},

micgala
31 Aug 2012, 5:24 AM
Hi. You might wanna try posting this in ext js forum instead (this one is for gxt)