Layer Visibility Enable/Disable

511
1
03-26-2012 11:54 PM
demdeberanz
New Contributor II
Hi everybody,
   after many tests I'm not able to show or hide layer provided by a rest service using this example http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm#jssa...


function updateLayerVisibility() {
        var inputs = dojo.query(".list_item"), input;
        //in this application layer 2 is always on.
        visible = [2];
        for (var i=0, il=inputs.length; i<il; i++) {
          if (inputs.checked) {
            visible.push(inputs.id);
          }
        }
        layer.setVisibleLayers(visible);
      }

It doesn't seems to affect the visibility of any layer.

Any suggestions?

Thanks everybody.
0 Kudos
1 Reply
RebeccaRothbard
New Contributor
You may have identified a solution at this point, but perhaps you need to call the correct layer...instead of [2] you should try [0].

just a thought,
rebecca
0 Kudos