Saturday 23 March 2019

lightning:map component

lightning:map introduced in winter 19 which can be use display a map of one or more locations using Google Maps. We can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street.

This component requires API version 44.0 and later. lightning:map has required attribute mapMarkers which accepts array of markers that indicate location. A market contains

  • Location information: This can be a coordinate pair of latitude and longitude, or an address composed of address elements.
  • Descriptive information: This is information like title, description and an icon which is information relevant to the marker but not specifically related to location.
Example
Create a new Object called 'Tower' with two new custom fields
1. Field Label: State
    Type: Master-Detail (Account)

2. Field Label: Location
    Type: GeoLocation (Latitude & Longitude Display Notation: Decimal )

Once metadata is ready then create some Tower records with Latitude & Longitude values.

Now copy & paste below code to show Map with markers.

UtilityClass.cls TowerController.cls TowerMap.cmp TowerMapController.js TowerMapHelper.js

No comments:

Post a Comment