I created an Account Locator application similar to the one found in the Trailhead example. I altered min slightly as I am using a custom object instead of the account object.
I was able to successfully create the Account Search, and List, with successful queries showing for the Search and the return list.
My issue is that the map appears on the right, but it doesn't show the markers, nor does it show the list to the right of it. Any help in understanding what I might have missed? I have included sample code for the Map component and controller below:
<aura:component>
<aura:handler event="c:AccountsLoaded" action="{!c.onAccountsLoaded}"/>
<aura:attribute name="mapMarkers" type="Map[]"/>
<lightning:card title="Retail Account Map" iconName="action:map">
<lightning:map mapMarkers="{!v.mapMarkers}"
center="{! v.center }"
zoomLevel="{! v.zoomLevel }"
markersTitle="{! v.markersTitle }"
showFooter="{ !v.showFooter }">
</lightning:map>
</lightning:card>
</aura:component>
Controller I used is:
({
onAccountsLoaded: function( component, event, helper ) {
var mapMarkers = [];
var accounts = event.getParam( 'accounts' );
for ( var i = 0; i < accounts.length; i++ ) {
var retail_account__c = accounts[i];
var marker = {
'location': {
'Street': retail_account__c.address__c,
'City': retail_account__c.City__c,
'PostalCode': account__c.Zip_Code__c
},
'title': retail_account__c.Name,
'description': (
'Phone: ' + retail_account__c.Phone__c +
'<br/>' +
'Website: ' + account.Website
),
'icon': 'standard:location'
};
mapMarkers.push( marker );
}
component.set( 'v.mapMarkers', mapMarkers );
}
})
The Accounts Loaded Event is:
<aura:event type="APPLICATION">
<aura:attribute name="accounts" type="Retail_Account__c[]"/>
</aura:event>
event.getParam( 'accounts' )
?