×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    1

    Get address from infoBubbles

    Hello

    I am using the following code, and when click on an address from resultList, an infobubble pops-up from the marker with the address details, such as street name, city etc.

    I just wondering if I can get these address details form the infobubble, or how to get these values from mapResultList by using nokia.places.search.manager.reverseGeoCode?

    Many Thanks!


    Code:
            var infoBubbles = new nokia.maps.map.component.InfoBubbles();
    
            var map = new nokia.maps.map.Display(document.getElementById("mapContainer"),
                                 {
                                     "components": [
                                               infoBubbles,
                                               new nokia.maps.map.component.ZoomBar(),
                                               new nokia.maps.map.component.Behavior(),
                                               new nokia.maps.map.component.TypeSelector(),
                                               new nokia.maps.map.component.ContextMenu()],
                                     "zoomLevel": 9,
                                     "center": [-27.471011, 153.023449]
                                 });
    
            var mapPlaceWidget = new nokia.places.widgets.Place({
                map: map
            });
    
            var mapResultList = new nokia.places.widgets.ResultList({
                targetNode: "mapResultlist",
                map: map,
                onRenderPage: function () {
                    mapResultList.displayOnMap();
                },
                events: [
    				{
    				    rel: "nokia-place-name",
    				    name: "click",
    				    handler: function (place2) {
    				        mapPlaceWidget.setPlace({ href: place2.href });
    				    }
    				}
                ]
            })
    
            var mapSb = new nokia.places.widgets.SearchBox({
                targetNode: "mapSearchbox",
                map: map,
                onResults: function (data) {
                    mapResultList.setData(data);
    
                }
               
            });
    Last edited by Summerd; 2013-05-13 at 07:02.

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    289

    Re: Get address from infoBubbles

    The infobubble is appended to the marker when an entry in the result list is clicked. If you look at the API reference for the constructor of the ResultList you will see that this takes a Place.Widget which in turn offers a handler for events.

    When a click event is handled, the handler has a reference to the place information which is defined here, and place holds the address info.

    Just alter the handler as shown:

    Code:
    var mapResultList = new nokia.places.widgets.ResultList({
    			targetNode: "mapResultlist",
    			map: map,
    			onRenderPage: function () {
    				mapResultList.displayOnMap();
    			},
    			events: [
    				{
    					rel: "nokia-place-name",
    					name: "click",
    					handler: function (place) {
    						mapPlaceWidget.setPlace({ href: place.href });
    						alert(place.vicinity);
    					}
    					
    				}
    			]
    		})

Similar Threads

  1. MH5 Show/Hide Infobubbles
    By tomgiam in forum [Archived] MH5: Nokia Maps Framework for mobile HTML5
    Replies: 9
    Last Post: 2013-03-29, 20:34
  2. Multiple Infobubbles on the Map at once.
    By harvo18 in forum [Archived] Maps API for Javascript
    Replies: 1
    Last Post: 2013-02-13, 16:28
  3. [moved] Mobile mh5 markers and infobubbles
    By pamepros in forum [Archived] MH5: Nokia Maps Framework for mobile HTML5
    Replies: 25
    Last Post: 2012-07-30, 17:43
  4. Removal of infobubbles with a markers container
    By amnesia7 in forum [Archived] Maps API for Javascript
    Replies: 2
    Last Post: 2012-06-28, 20:57

Posting Permissions

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