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
Janno RipJanno Rip 

Create <apex:mapMarker> without reRerending <apex:Map>

Hello,

is it possible to create and display an apex:mapMarker without reRerender the whole apex:map? I have build a functionality that creates an mapMarker when someone clicks a company name in a table. The goal is to switch to mouseover. However this will be poor user experience if the map reRerenders everytime when someone hovers over the company name.

Can this be done?

Here is my status quo:

User-added image
Visualforce:

        <!-- Add a CUSTOM map marker for the account that was clicked on -->  
           <apex:mapMarker title="{!HoverAcc.Name}" position="{!HoverAcc.GeoLocPosition__c}" icon="{!URLFOR($Resource.ZipFile,'/green.png')}"/>

 
<apex:form > 
                 <apex:commandLink action="{!findNearby}" value="{!war.ShippingStreet}, {!war.ShippingPostalCode} {!war.ShippingCity}" reRender="map">
                        <apex:param name="HoverAccount" value="{!war.id}" assignTo="{!HoverAccount}" />
                     <apex:param name="center" value="{!war.MapCurrentAddress__c}" assignTo="{!mapCenter}" />
                     <apex:param name="zoom" value="13" assignTo="{!zoom}"/>
                    </apex:commandLink> </apex: form>

Apex Class:
 
public Account HoverAcc {get;set;}

public string HoverAccount {get; set;}

    if(HoverAccount != null) { 
            HoverAcc = [SELECT Id,Name,MapCurrentAddress__c,LocateCity__c,LocateCity__Latitude__s,LocateCity__Longitude__s,ShippingState,MetaData_Distance_Customer__c,Blacklisted__c,MetaData_Last_Deal_in_days__c,WZ_Buchstabe__c,WZ_Abteilung__c,WirtschaftszweigWZ08__c, WZ_Code_ebene_2__c,Mitarbeiternzahl_final__c,AD_MS_Rel_Anzahl_bez__c,GeoLocPosition__c,Geolocation__c,Accountinhaber_Text__c,Auftragseingangstyp__c,ShippingStreet,ShippingCity,ShippingPostalCode,URL_zum_CC__c FROM Account WHERE ID =:HoverAccount]; 
       }
        
      
        else {
            HoverAcc = [SELECT Id,Name,MapCurrentAddress__c,LocateCity__c,LocateCity__Latitude__s,LocateCity__Longitude__s,ShippingState,MetaData_Distance_Customer__c,Blacklisted__c,MetaData_Last_Deal_in_days__c,WZ_Buchstabe__c,WZ_Abteilung__c,WirtschaftszweigWZ08__c, WZ_Code_ebene_2__c,Mitarbeiternzahl_final__c,AD_MS_Rel_Anzahl_bez__c,GeoLocPosition__c,Geolocation__c,Accountinhaber_Text__c,Auftragseingangstyp__c,ShippingStreet,ShippingCity,ShippingPostalCode,URL_zum_CC__c FROM Account WHERE ID =:currentAccount.id]; 
       }



Thanks!


  [1]: https://i.stack.imgur.com/iHghB.png
ShirishaShirisha (Salesforce Developers) 
Hi Janno,

Greetings!

I don't think so.As this depends on the <apex:map>.

Reference:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_mapMarker.htm

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri