Ask a questionAsk a question
 

AnswerMMMarkerOverlay - Info Boxes and Clustering

  • Monday, September 28, 2009 4:41 PMstav999 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    When I hook up the event to fire on the openInfoBox and I'm using clustering then I cannot set the html of the info box by calling the setInfoBoxContent, it works fine if the overlay has not come from a cluster. (I code recreate this by using openinfoBox but this loses the clustering paging which is not good)

    The code used is as follows:

    //The attribute (applyhtml) of the marker is set when it is created to true then unset to stop it setting the html twice and to stop it from overwriting the cluster list

    function openInfoBoxEvent(eventType, eventTarget, arg1, arg2, arg3)
    {
        if(arg1.getAttribute("applyhtml") == "true")
        {
            arg1.setAttribute("applyhtml","");
            arg1.setInfoBoxContent("<strong>SOME HTML</strong>",{});
        }
    }

    The code does not throw an error but due to the arg1 (parent marker) not being formatted in the same way (in the underlying HTML, ie multiple MMcontent divs with an MMclusterindex for clustered items) the setinfoBoxContent does nothing.

    I presume you should be able to set the html of the info box whether it has come from a cluster or not so could someone please advise on where I'm going wrong?

    Stav

    •  

Answers

  • Tuesday, October 06, 2009 3:50 PMJohn-SheridanMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    When I hook up the event to fire on the openInfoBox and I'm using clustering then I cannot set the html of the info box by calling the setInfoBoxContent, it works fine if the overlay has not come from a cluster. (I code recreate this by using openinfoBox but this loses the clustering paging which is not good)

    The code used is as follows:

    //The attribute (applyhtml) of the marker is set when it is created to true then unset to stop it setting the html twice and to stop it from overwriting the cluster list

    function openInfoBoxEvent(eventType, eventTarget, arg1, arg2, arg3)
    {
        if(arg1.getAttribute("applyhtml") == "true")
        {
            arg1.setAttribute("applyhtml","");
            arg1.setInfoBoxContent("<strong>SOME HTML</strong>",{});
        }
    }

    The code does not throw an error but due to the arg1 (parent marker) not being formatted in the same way (in the underlying HTML, ie multiple MMcontent divs with an MMclusterindex for clustered items ) the setinfoBoxContent does nothing.

    I presume you should be able to set the html of the info box whether it has come from a cluster or not so could someone please advise on where I'm going wrong?

    Stav


    Hi Stav
    Not sure if this is the issue, but upon review we have identified a bug, updating the content of an infobox that is part of a cluster doesn’t update the cluster so the change is not visible until either the marker is removed from the cluster or the cluster is regenerated after a zoom.  We will escalate this to the development team for a fix.

    If this is not the issue you are experiencing, please can you provide us with further information.

    Thanks, John.

All Replies

  • Monday, September 28, 2009 8:53 PMRossko57 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It's not entirely clear to me what you are trying to do.  Is it overwriting the content of the 'index' infobox for a marker representing a cluster?
    I'm not sure that this will work with setInfoBoxContent, as the API is creating the content as required and may not even read that value from the cluster-marker.

    As you say, your code doesn't currently try to do that, because it's only operating on markers with your custom 'applyhtml' attribute. The API-created cluster marker won't have that, of course.   You can use that to determine if the clicked marker IS a cluster-marker, and if so take special action.

    The special action could be - close the API generated cluster index InfoBox and open your own InfoBox, formatted as you wish.


  • Tuesday, October 06, 2009 3:50 PMJohn-SheridanMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    When I hook up the event to fire on the openInfoBox and I'm using clustering then I cannot set the html of the info box by calling the setInfoBoxContent, it works fine if the overlay has not come from a cluster. (I code recreate this by using openinfoBox but this loses the clustering paging which is not good)

    The code used is as follows:

    //The attribute (applyhtml) of the marker is set when it is created to true then unset to stop it setting the html twice and to stop it from overwriting the cluster list

    function openInfoBoxEvent(eventType, eventTarget, arg1, arg2, arg3)
    {
        if(arg1.getAttribute("applyhtml") == "true")
        {
            arg1.setAttribute("applyhtml","");
            arg1.setInfoBoxContent("<strong>SOME HTML</strong>",{});
        }
    }

    The code does not throw an error but due to the arg1 (parent marker) not being formatted in the same way (in the underlying HTML, ie multiple MMcontent divs with an MMclusterindex for clustered items ) the setinfoBoxContent does nothing.

    I presume you should be able to set the html of the info box whether it has come from a cluster or not so could someone please advise on where I'm going wrong?

    Stav


    Hi Stav
    Not sure if this is the issue, but upon review we have identified a bug, updating the content of an infobox that is part of a cluster doesn’t update the cluster so the change is not visible until either the marker is removed from the cluster or the cluster is regenerated after a zoom.  We will escalate this to the development team for a fix.

    If this is not the issue you are experiencing, please can you provide us with further information.

    Thanks, John.