You need to sign in to do that
Don't have an account?
Brian Kessler
Lightning Component Framework Specialist: How Do I Get the Map to Display Correctly?
Hi,
I'm currently struggling with Lightning Component Framework Specialist Challenge 10.
I'm successfully using an event to pass values into the Map's client side controller, and Leaflet seems to be doing something, but:
1. The marker is displayed on a grey area, not a map.
2. When I click a second boat, instead of updating the map, an error pops up informing me "Uncaught Action failed: c:Map$controller$onPlotMapMarker [Map container is already initialized.]"
This is my onPlotMapMaker method:
What's wrong with it?
I'm currently struggling with Lightning Component Framework Specialist Challenge 10.
I'm successfully using an event to pass values into the Map's client side controller, and Leaflet seems to be doing something, but:
1. The marker is displayed on a grey area, not a map.
2. When I click a second boat, instead of updating the map, an error pops up informing me "Uncaught Action failed: c:Map$controller$onPlotMapMarker [Map container is already initialized.]"
This is my onPlotMapMaker method:
onPlotMapMarker: function(component, event, helper) { var id = event.getParam('sObjectId'); var lat = event.getParam('lat'); var long = event.getParam('long'); var label = event.getParam('label'); var mapContainer = component.find('map').getElement(); var map = L.map(mapContainer).setView([lat, long], 13); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); L.marker([lat, long]).addTo(map) .bindPopup(label) .openPopup(); }
What's wrong with it?
See Lightning Component Framework Specialist, Step 10 : What is wrong with my onPlotMapMaker() method? (https://developer.salesforce.com/forums/ForumsMain?id=9060G000000MVHvQAO#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=OPENQUESTIONS&id=9060G000000MVSeQAO)
All Answers
See Lightning Component Framework Specialist, Step 10 : What is wrong with my onPlotMapMaker() method? (https://developer.salesforce.com/forums/ForumsMain?id=9060G000000MVHvQAO#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=OPENQUESTIONS&id=9060G000000MVSeQAO)
Am unable to get name over markup in map.
MapController.js
Map Renderer.js
Can you please help?
Thanks
Yashita
I am having issue in passing latitude and longitude as an event parameters. Below is my onBoatClick controller.
console.log display label and boat Id. However values for lat and lon is undefined. Not sure, what I am missing here.
Any help is appreciated.
Thanks,
Manish
I am also having the same issue. Did you get this resolved? If so, what was the solution?
Appreciate your help.
Thanks.
Challenge Not yet complete... here's what's wrong:
We couldn't find a design resource in the Map bundle.
i am not able to clear this step.
"Challenge Not yet complete... here's what's wrong:
MapController.js must have an event handler named onPlotMapMarker that uses the latitude and longitude that were passed through the event to update the boat’s location."
Yet I already have onPlotMapMarker in my MapController.js which is shown below.
Has anyone encountered this problem before as I haven't seen anything when I checked in Google. Thanks!
"Challenge Not yet complete... here's what's wrong:
MapController.js must have an event handler named onPlotMapMarker that uses the latitude and longitude that were passed through the event to update the boat’s location."
MapController.js
Here's my update, I think trailhead needs to see that the location object of the component has been set but you might want to comment it out when testing because it produces errors. Uncomment it out when you need to verify the step.
Let me know if it doesn't work.
<design:attribute name="width" label="Map Width" description="" />
<design:attribute name="height" label="Map Height" description="" />
</design:component>
Use this as Map design attribute.