You need to sign in to do that
Don't have an account?
Valentin F.
Refresh leaflet map when changing record
When I change record, my map is not refreshing and I got the following error :
'[Map container is already initialized.]'
The workaround I found was to put map as a global variable and then, in my init function :
Thank you for helping me !
'[Map container is already initialized.]'
The workaround I found was to put map as a global variable and then, in my init function :
if(map != null && map != undefined) { map.remove(); }This way I've no more errors but I've to refresh twice the record page to get the map displaying. When I change page I get a blank map but it doesn't recreate.
Thank you for helping me !
Whenever you visit the list of leads, it keeps it in memory and just applies a css style display: none.
When you're on a lead, the others leads you've visited before and the leads' list still are present on the page you're on. Just using the display: none.
The problem with the map was that it was displayed but not in the active content. Each layout dispose of a class "one-content" (for each lead for example) and the one you see get the "visible" class too. This way, the map id was used everytime for a different lead and whenever I tried to retrieve it to display my map, it was displayed to the most "relevant" map id. However, sometimes the most relevant map id for Salesforce wasn't the one of the active layout and I couldn't see it even if it was displayed in another part of the page with display: none.
The solution I found was to give an unique id, thus "map + currentRecordId". This way I could get the good id and display my map inside of it.