1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    33
    Vote Rating
    0
    wiwi is on a distinguished road

      0  

    Default Hello

    Hello


    I'm trying to display a marker within a map, in my panel, but it doesn't shows up , here is my code :

    Ext.setup(
    {
    onReady: function(){
    var pnl = new Ext.Panel({
    layout:'fit',
    fullscreen:true,
    dockedItems:[
    {
    dock:'top',
    xtype:'toolbar',
    title:'Simple map',
    }
    ],
    items:[{
    xtype:'map',
    getLocation:true,
    markers: [{
    'lat': 42.339641,
    'long': -71.094224,
    marker: {title: 'Boston Museum of Fine Arts'}
    }]
    }
    ]
    })
    }
    });

    have you ever try to do the same thing as here?

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    Bath, UK
    Posts
    52
    Vote Rating
    9
    daniel.gallo will become famous soon enough

      0  

    Default


    In the future, please remember to post your code using CODE tags.

    The following example should work for you. I've usually used the "maprender" listener to add markers after the render of the map.

    Code:
    Ext.setup
    ({
        onReady: function()
        {
            var pnl = new Ext.Panel
            ({
                layout:'fit',
                fullscreen:true,
                dockedItems:
                [{
                    dock:'top',
                    xtype:'toolbar',
                    title:'Simple map',
                }],
                items:
                [{
                    xtype:'map',
                    mapOptions: 
                    {
                         zoom: 12,
                         center: new google.maps.LatLng(42.339641, -71.094224) 
                     },
                    listeners: 
                    {
                        maprender: function(mapcomp, map)
                        {
                            var marker = new google.maps.Marker
                            ({
                                position: new google.maps.LatLng(42.339641, -71.094224),
                                map: map,
                                title: "Boston Museum of Fine Arts"
                            });
                        }
                    }
                }]
            })
        }
    });
    Daniel Gallo
    Sales Engineer EMEA
    Sencha UK Ltd

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    33
    Vote Rating
    0
    wiwi is on a distinguished road

      0  

    Default


    Sorry for the code tags, and Thank you very much, now it is working very well !!

Thread Participants: 1