function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bryant Daniels 46Bryant Daniels 46 

leaflet map not showing in lightning component record page

Was wondering if anyone is have a problem displaying the map from leaflet onto a lighting component record page. Following the Accounts near me trailhead. In the trailhead you can see the map in the App which is fine. But i am not able to show it in a lighting component.
SandhyaSandhya (Salesforce Developers) 
Hi,

Try to clear your browser cache and cookies and then try again.

Best Regards,
Sandhya
Bryant Daniels 46Bryant Daniels 46
Hi Sandhya,
Thanks for the response that wasn't the case.
Michael Scherbaum 5Michael Scherbaum 5
Hi Bryant, couple of things you wanna check:
1. you've added leaflet.css and leaflet.js as static resource and have them loaded in your markup. Call you controller function after they are loaded e.g. "afterScriptsLoaded="{!c.createMap}"/>"
2. you have a div in your markup with an id such as "mapid" or "map"
3. when you create your map in the controller you set the map to be in the div you added to the markup e.g.  "var map = new L.map('mapid', {"
4. you wanna make sure that you hve a tile layer added as specified in the code section of the trail

This should give you a good idea how to get started too: http://leafletjs.com/examples/quick-start/
Chidanand MChidanand M
Hi Bryant,

Were you able to fix the issue. I am also facing the same issue. Map is getting populated in my developer org. But it is showing blank in my sandbox. Can you please tell me the trick that worked for you?
Chidanand MChidanand M
Map isn't getting displayed in lightning component. It shows only in lightning App
Leonardo Brozinga ViglinoLeonardo Brozinga Viglino
Did anyone fix that ? Facing the same issue... Map doesnt show up
Michael_ScherbaumMichael_Scherbaum
I managed to get my map displayed when I changed the Bundle Version Settings of the component to API Version 38. Not sure why, but seems to work.
Component Settings