Results 1 to 3 of 3

Thread: Add markers to Ext.Map

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    18
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Are you doing this after the maprender event has fired on the Ext.Map?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •