1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    203
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default 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:
    Code:
    { center: new google.maps.LatLng(37.381592, -122.135672), zoom : 12 }
    but not working.

    Can anyone point in the right direction?

    Thanks
    Allister

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,892
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Use an override or event handler to set configurations that need JavaScript expressions.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    203
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,892
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    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

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    203
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default


    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

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Posts
    203
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default


    Okay - update on this.

    Got it working at last with:
    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
                    }
                }
        }
        
    });
    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.

    Allister

  7. #7
    Sencha User kitesurf's Avatar
    Join Date
    Jan 2012
    Location
    London, England
    Posts
    68
    Vote Rating
    2
    kitesurf is on a distinguished road

      0  

    Default


    hi allisterf,

    Can you explain how you applied the override in Architect? I am also in the same position as you and am trying to set the config for a map object in Architect but not sure how to do this.

    thanks!

  8. #8
    Sencha - Architect Dev Team
    Join Date
    Jan 2009
    Location
    Frederick, Maryland
    Posts
    669
    Vote Rating
    29
    jminnick will become famous soon enough jminnick will become famous soon enough

      0  

    Default


    There is a Create Override button at the top of the canvas while in Code view...

    override.PNG
    Jason Minnick
    Sencha Architect Development Team

  9. #9
    Sencha User
    Join Date
    Aug 2011
    Posts
    203
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default


    I did an example here
    http://www.sencha.com/forum/showthre...279-Center-Map

    Hop that helps
    Allister

Thread Participants: 3

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar