locked
AddControl and Refresh problem with AJAX map control RRS feed

  • Question

  • I have a map onto which I place an empty div using map.AddControl() with the innerHTML=""  like this:  

    function CreateBusy() {
      divBusyPanel = document.createElement("div");
      divBusyPanel.id = "divBusy";
      divBusyPanel.style.top = "75px";
      divBusyPanel.style.left = "75px";   
      divBusyPanel.style.width = "400px";
      divBusyPanel.style.border = "1px solid black";
      divBusyPanel.style.background = "white"; //"#DCDCDC";
      divBusyPanel.style.fontFamily = "verdana roman";
      divBusyPanel.style.fontSize = "8pt";
      divBusyPanel.style.fontWeight = "bold";
      divBusyPanel.innerHTML = "";
      map.AddControl(divBusyPanel);
    }

    The contents of this div then dynamically updated at various points in my application by setting the innerHTML to some value using the ShowBusy method below:

    function ShowBusy(title, msg) {
        
      if (divBusyPanel == null)
        CreateBusy();
    
      divBusyPanel.innerHTML = 
        "<div>" +
        "<table width='100%' border='0' cellpadding='0' cellspacing='0'>" +
        "<tr bgcolor='#f0f0ff'><td " + maptitlestyle+ "><center><b>" + title + "</b></center></td></tr>" +
        "</table>" +
        "<br/><center>" +msg+ "</center><br/>";
        "</div>";
    }
    The issue that i'm having is that when the ShowBusy("xxx","yyy") is called at various places in my application, the div is not updated immediatly. Do I need to call a method to tell the map to update or refresh any controls it is displaying?

    I did have some success by adding setTimeout at various places in my code after the ShowBusy method is called but there must be a cleaner way to do it.

    cheers
    sanjay 
    Thursday, February 11, 2010 1:59 PM

Answers

  • What about calling HideControl(divBusyPanel) then updating the content then ShowControl(divBusyPanel). Not that pretty but better than a having a timer if it works
    Thursday, February 11, 2010 2:56 PM

All replies

  • What about calling HideControl(divBusyPanel) then updating the content then ShowControl(divBusyPanel). Not that pretty but better than a having a timer if it works
    Thursday, February 11, 2010 2:56 PM
  • thanks for the suggestion.

    After some more investigation it looks like the problem has something to do with the way I an calling ShowBusy because if I put together a simpler example, it doesn't have the same problem. Basically I am calling ShowBusy as I go round a loop of multiple map.Find() calls (and callbacks).  

    sanjay
    Thursday, February 11, 2010 5:24 PM