<?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: Feature layers added to map with visible property false cannot be toggled on/off. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746533#M69078</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mukta,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I see the same thing here. I even tried to set the visibility on the layerView as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe &lt;A href="https://community.esri.com/migrated-users/6443"&gt;Rene Rubalcava&lt;/A&gt;​ or &lt;A href="https://community.esri.com/migrated-users/51882"&gt;Undral Batsukh&lt;/A&gt; could help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2016 14:14:58 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2016-07-14T14:14:58Z</dc:date>
    <item>
      <title>Feature layers added to map with visible property false cannot be toggled on/off.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746532#M69077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have found that if we add a Feature Layer to a map with visible property set to false like so, we cannot toggle the layer back on by just setting the visible property back to true:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;// If visible is false when adding the feature layer, cannot toggle the layer back on by clicking the button&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureLayer = new FeatureLayer({&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices.arcgis.com%2FV6ZHFr6zdgNZuVG0%2Farcgis%2Frest%2Fservices%2FLandscape_Trees%2FFeatureServer%2F0" rel="nofollow" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0&lt;/A&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; visible: false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.add(featureLayer);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;However, if we set the visible property to true while adding the layer, the layer can be toggled on/off by setting visible property true/false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a JS Fiddle showing visible property false when adding the layer (Here is the bug):&amp;nbsp; &lt;A href="https://jsfiddle.net/eobs0t7h/" title="https://jsfiddle.net/eobs0t7h/"&gt;JSFiddle&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Here is a JS Fiddle showing visible property true when adding the layer: &lt;A href="https://jsfiddle.net/pu36bju8/" title="https://jsfiddle.net/pu36bju8/"&gt;JSFiddle&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a workaround around this? Is the fix for this bug in the Esri backlog?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: some other layers (eg: vector tile layers) do seem to work ok even though the visible property is false when adding the layer. I have seen this bug only in the feature layer so far.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 21:26:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746532#M69077</guid>
      <dc:creator>MuktaPuri</dc:creator>
      <dc:date>2016-07-13T21:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Feature layers added to map with visible property false cannot be toggled on/off.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746533#M69078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mukta,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I see the same thing here. I even tried to set the visibility on the layerView as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe &lt;A href="https://community.esri.com/migrated-users/6443"&gt;Rene Rubalcava&lt;/A&gt;​ or &lt;A href="https://community.esri.com/migrated-users/51882"&gt;Undral Batsukh&lt;/A&gt; could help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 14:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746533#M69078</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-07-14T14:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Feature layers added to map with visible property false cannot be toggled on/off.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746534#M69079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a bug. &lt;/P&gt;&lt;P&gt;This workaround works for me and hope it does for you. Don't set the visible property to false in the feature layer's constructor. Instead set the FeatureLayer.visible = false when layerview is created as shown below.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;view.whenLayerView(featureLayer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .then(function(layerView) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.visible = false;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; })&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .otherwise(function(error) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // An error occurred during the layerview creation&lt;/P&gt;&lt;P&gt; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 19:48:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layers-added-to-map-with-visible-property/m-p/746534#M69079</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2016-07-14T19:48:01Z</dc:date>
    </item>
  </channel>
</rss>

