Hybrid View
-
23 Nov 2012 3:34 AM #1
Map Component Map Options
Map Component Map Options
Finding it difficult to see how to code the map options correctly to be able to specify any particular location. Have tried adding:
but not working.Code:{ center: new google.maps.LatLng(37.381592, -122.135672), zoom : 12 }
Can anyone point in the right direction?
Thanks
Allister
-
26 Nov 2012 7:00 AM #2
Use an override or event handler to set configurations that need JavaScript expressions.
Aaron Conran
@aconran
Sencha Architect Development Team
-
26 Nov 2012 8:34 AM #3
Hi Aaron - and thanks for the reply.
I guess I'm a bit confused. In Sencha 2.1.0, a map component has now been included, with a full range of configuration options, including mapOptions which I understood was the place to add coordinates. How is it that the primary requirement of being able to set coordinates in a map can't actually be achieved in that config? Or am I not understanding it properly?
The thing about overrides, is that there is little documentation of how to do them. Mostly in the forum an overrides question gets the reply 'you shouldn't be using them, and they'll be deprecated soon anyway'!
However, - even with the map configuration options -maps in sencha still need an override to work, can you give some guidance...maybe some code and an explanation of where it needs to go?
Thanks
Allister
-
26 Nov 2012 12:21 PM #4
The config property grid does not support JavaScript expressions. When you are instantiating an instance of a google class this is a JS expression.
In touch you could also override the initialize method and invoke this.setMapOptions();Aaron Conran
@aconran
Sencha Architect Development Team
-
21 Jan 2013 4:50 AM #5
I wish I could say I'd solved this, but I'm afraid not...
I've never used overrides before. If the mapOptions in the map component's config doesn't actually allow anything than showing Cupertino, could you clarify. Would it be possible to include a simple architect project to show what you mean when you indicate the use of an override to set different lat and long for a map?
Allister
-
21 Jan 2013 9:38 AM #6
Okay - update on this.
Got it working at last with:
I was just putting the options directly rather than wrapping them in a 'config' item. You also have to remember that the updated map will NOT show on the canvas - you have to preview or publish to see the results.Code:Ext.define('MyApp.view.override.MyMap', { override: 'MyApp.view.MyMap', config: { mapOptions : { center : new google.maps.LatLng(51.5006, -0.1246), //nearby London zoom : 12, mapTypeId : google.maps.MapTypeId.ROADMAP, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.DEFAULT } } } });
Allister


Reply With Quote