when i used the sencha touch2.2.1,i met a question. In the viewer:
items: [{
id: 'mapCanvas',
xtype:'map',
useCurrentLocation: true,
}]
In the controller:
var map= Ext.getCmp('mapCanvas');
console.dir(map);
var marker= new google.maps.Marker({
position: new google.maps.LatLng(25,118),
});
marker.setMap(map);
report the error:
Uncaught InvalidValueError: setMap: not an instance of Map, and not an instance of StreetViewPanorama
I can see the map,but i can't see the marker, and how to solve the problem?
Try this:
It worked for me!
map
is not an instance of google map .The
marker.setMap
method expects the argument to be a google.maps.Map object. This is not one of those:mapCanvas is Ext map component which holds the map instance.
You can add the marker to the map directly by using the marker's setMap() method, as shown in the example below:
Try this:
Here
map
is the renderedgoogle.map.Map
instance