PDA

View Full Version : [CLOSED] Google Map RC2, useCurrentLocation



sebastianwoinar
28 Nov 2011, 2:42 AM
Hello,
it seems like the Ext.Map component doesn't get initialized correctly when it is configured for using the current location - with RC1 it worked as expected.

For example:

var mapPanel = new Ext.create("Ext.Panel",{
fullscreen: true,
layout:'fit',
id: 'myPanel',
items: [{
xtype: 'map',
id :'map',
useCurrentLocation: true,
}]
});


Will not create a map.
mapPanel.down("map").getMap() == null

Whereas:

var mapPanel = new Ext.Panel({
fullscreen: true,
layout:'fit',
id: 'myPanel',
items: [{
xtype: 'map',
id :'map',
useCurrentLocation: false,
}]
});

works like a charm.

My browser supports geo location.

Can anybody confirm this issue?

Thanks,
Seb.

Jamie Avins
28 Nov 2011, 10:14 AM
There were several issues in PR2 (this is one of them) with Map that should be fixed in the next release.

kamalf
5 Mar 2012, 7:08 AM
I can verify that this is still broken on RC. Current workaround is to set useCurrentLocation: false in config, but this.setCurrentLocation(true) in initialize.

hawkinbj
7 Mar 2013, 5:06 PM
Thank you for sharing this tip! This bug/problem STILL exists in 2.1.1 anytime you manually create a map instead of declaring it in an xtype/config. Since you have to get the maprender event to fire before you can actually do anything with google (you need the Ext.Map.getMap() wrapped google map), you HAVE to create the map in a container config - which means you have to display it.

Similarly, if you DO declare a map in a config and set it hidden, the maprender event will never fire and this getMap() will return null. It seems that if you want to use Ext.Map you're meant to actually display the map to user, as opposed to merely using it behind the scenes to populate lists or something similar. Granted, you could just do all your Google map operations by writing your own javascript, but it seems silly given there's a perfectly good wrapper Sencha has provided. Hopefully this is considered in a future release