<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: layer.setLayerVisibility() not working for DynamicMapServiceLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layer-setlayervisibility-not-working-for/m-p/367475#M34083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry - the title of this thread should read "layer.setVisibleLayers() ...", not "setLayerVisibility() ...".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2012 20:27:41 GMT</pubDate>
    <dc:creator>JasonGreenlaw</dc:creator>
    <dc:date>2012-01-10T20:27:41Z</dc:date>
    <item>
      <title>layer.setLayerVisibility() not working for DynamicMapServiceLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layer-setlayervisibility-not-working-for/m-p/367474#M34082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I initially posted this question in the 10.1 beta forum but thought this might be the better place for it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having problems toggling the visibility of layers in a dynamically-drawn map service (10.1 beta 2) using the JavaScript API (versions 2.5 and 2.6 behave the same).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am following the sample described at &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_explicitlayerlist.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_explicitlayerlist.html&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;When I point my code to the sample MapServer given in the example ("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer" rel="nofollow" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer&lt;/A&gt;&lt;SPAN&gt;"), which appears to be at version 10.0, the setLayerVisibility method works fine; however when I point the same code to my own 10.1 beta 2 map service (and modify the layer IDs accordingly), it ceases to work properly.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the Service Editor, under Capabilities &amp;gt; Mapping, I've enabled "Allow per request modification of layer order and symbology," but this did not solve the problem.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The strange thing is that it seems to work partially, because my layer does appear when I first set its visibility (as long as I am at the initial map extent).&amp;nbsp; But when I pan or zoom, the layer becomes broken and does not redraw at any scale, and if I call &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;layer.setVisibleLayers([-1]);&lt;/PRE&gt;&lt;SPAN&gt; to turn all layers off, the layer remains on screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The DynamicMapServiceLayer displays fine if I specify the visible layer IDs in the ImageParameters property during construction, but as soon as I call setVisibleLayers() it becomes broken.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Very strange behavior.&amp;nbsp; A bug in 10.1 or the JavaScript API I wonder?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 20:25:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layer-setlayervisibility-not-working-for/m-p/367474#M34082</guid>
      <dc:creator>JasonGreenlaw</dc:creator>
      <dc:date>2012-01-10T20:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: layer.setLayerVisibility() not working for DynamicMapServiceLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layer-setlayervisibility-not-working-for/m-p/367475#M34083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry - the title of this thread should read "layer.setVisibleLayers() ...", not "setLayerVisibility() ...".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 20:27:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layer-setlayervisibility-not-working-for/m-p/367475#M34083</guid>
      <dc:creator>JasonGreenlaw</dc:creator>
      <dc:date>2012-01-10T20:27:41Z</dc:date>
    </item>
  </channel>
</rss>

