1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    18
    Vote Rating
    0
    andrea88v is on a distinguished road

      0  

    Default Unanswered: Add markers to Ext.Map

    Unanswered: Add markers to Ext.Map


    Hi, I've a NestedList of locations divided by category.

    At the last level I want to show in a map the points of locations in that level.

    I've a tab panel in which I've two tabs: the first contain an Ext.NestedList, the second contains an Ext.Map.

    I've already implemented the function that controls in which level I am; in that level I've already implemented a function to calcolate the user distance from the current location to the location for each element in that level of NestedList.

    Next I try to add a point to the Map for that location in this way:

    Code:
    var myLatlng = new google.maps.LatLng(lat, lon);
    var marker = new google.maps.Marker({
            position: myLatlng,
    	map: Ext.getCmp('mypoi').map
    });

    Console doesn't show any errors but the marker isn't added to the map.


    Where's the mistake?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    436
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Are you doing this after the maprender event has fired on the Ext.Map?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
    Jonny F is on a distinguished road

      0  

    Default


    Quote Originally Posted by andrea88v View Post

    Code:
    var myLatlng = new google.maps.LatLng(lat, lon);
    var marker = new google.maps.Marker({
            position: myLatlng,
        map: Ext.getCmp('mypoi').map
    });
    You need to use the getMap() method. This should work..

    Code:
    var myLatlng = new google.maps.LatLng(lat, lon);
    var map = Ext.getCmp('mypoi').getMap();
    var marker = new google.maps.Marker({
            position: myLatlng,
        map: map
    });

Tags for this Thread