[Chameleon] Chameleon 2.6 RC1 Broken Update Map in JSAPI

Normand Savard nsavard at mapgears.com
Wed Sep 12 15:14:29 EDT 2007


Nolte, Tim wrote:

>Due to a problem with the Go Back/Forward buttons in JSAPI mode under
>v2.4 I tried v2.6b. Now the Update Map button doesn't work in JSAPI
>mode. It had worked fine in v2.4. I'm using the custom expander tree
>legend that is found on the Wiki. Here's my code and perhaps someone can
>help me from here.
>
>  
>
Tim,

If you change the following line of code (see line location above):

<input type="checkbox" id="cbl_[leg_layer_name]"
name="legendlayername[]" value="[leg_layer_name]" [if name=layer_status
oper=eq value=1]CHECKED[/if][if name=layer_status oper=eq
value=2]CHECKED[/if]>

to be:

	  	<input type="checkbox" id="cbl_[leg_layer_name]"
name="legendlayername[]" value="[leg_layer_name]" [if name=layer_status
oper=eq value=1]CHECKED[/if][if name=layer_status oper=eq
value=2]CHECKED[/if] onclick="ChangeLayerStatus('[leg_layer_name]')">  <<<<<<<++++++++


And add the following JavaScript function:

function ChangeLayerStatus(szLayerName)
{

    if(typeof goCWCJSAPI == "undefined")
    {
        return false;
    }

    szStatus = goCWCJSAPI.oMap.GetLayerByName(szLayerName).GetStatus();
    //alert('status='+szStatus)

    if(szStatus == "ON")
    {
        szNewStatus = "OFF";
    }
    else
    {
        szNewStatus = "ON";
    }

    goCWCJSAPI.oMap.GetLayerByName(szLayerName).SetStatus(szNewStatus);


    szStatus = goCWCJSAPI.oMap.GetLayerByName(szLayerName).GetStatus();
    //alert('status='+szStatus)

}

Does it work?  Check the page source to be sure that the line was 
modified correctly.


Norm


More information about the Chameleon mailing list