Results 1 to 3 of 3

Thread: Help with GMAP with dynamic locations

  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    76

    Default Help with GMAP with dynamic locations

    I have a map that is created when the map icon (on a tree) is clicked. The locations that show are based on where in the tree the map is located (I have multiple map icons, think of a map icon per project, each project has multiple locations different from the other projects)
    I can get the locations to show but not the title.
    Relevant code.
    Code:
    var myMarkers = [];
    var myGeo = [];
    var myTitle = [];
    proj_map_store.each(function(r) {
      var mySWTF= Ext.getCmp('myMap');
        myGeo[0] = r.get('address') + ', ' + r.get('city') + ' ' + r.get('state') + ' ' + r.get('zip');
        myTitle[0] = r.get('title');
        myMarkers.push(myGeo,myTitle);
        mySWTF.addMarkers(myMarkers);
     });
    Like I said the locations make it on the map, but I can't figure out how to get them to have a title. The code above is just one of my attempts. I have searched the FAQs and forms repeatedly to no avail. If I missed something obvious, feel free to flame...but try and be helpful too.
    NOTE: The myTitle doesn't do anything.

    Thanks

  2. #2
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    76

    Default

    Bueller...Bueller...

  3. #3
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501

    Default

    Your code is quite confusing...why are myGeo and myTitle arrays? and why are you adding to the first item in those arrays and pushing them into another array?

    addMarkers takes an array of objects, not an array of arrays.

    It should look something like this:
    Code:
    [{
            lat: 42.339641,
            lng: -71.094224,
            marker: {title: 'Boston Museum of Fine Arts'}
    },{
            lat: 42.339419,
            lng: -71.09077,
            marker: {title: 'Northeastern University'}
    }]
    Notice that the title is part of the nested marker object, not the main object.

Posting Permissions

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