<?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: map.removeAllLayers Error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214610#M19874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I am using the clear() method on the graphics layer to allow the user to clear all the graphics on the map - that way I don't have to remove any layers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Sep 2013 14:13:31 GMT</pubDate>
    <dc:creator>DK5</dc:creator>
    <dc:date>2013-09-18T14:13:31Z</dc:date>
    <item>
      <title>map.removeAllLayers Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214606#M19870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In V3.5 I have a basemap, the default graphics layer, and I am adding another graphics layer that I allow users to draw polygons on.&amp;nbsp; Whenever I add this other graphics layer, and later try to remove it (ie. map.removeAllLayers() or map.removelayer(...)) I am getting an error back from the ArcGIS javascript:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Unable to get property 'declaredClass' of undefined or null reference"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I don't add this graphics layer, then the calls to remove work.&amp;nbsp; I add the layer by doing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var newGraphicsLayer = new esri.layers.GraphicsLayer({ id: 'someIDhere' });&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.addLayer(newGraphicsLayer);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&amp;nbsp; Is this an official bug and is there a patch for this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 17:06:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214606#M19870</guid>
      <dc:creator>DK5</dc:creator>
      <dc:date>2013-09-13T17:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: map.removeAllLayers Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214607#M19871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the snippets that you've posted look correct so presumably there's something else in your code which is causing the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you link to your live site, or put the complete example on JS Fiddle, etc?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2013 11:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214607#M19871</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2013-09-16T11:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: map.removeAllLayers Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214608#M19872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have changed my code temporarily to not have to remove layers, so I just keep the additional graphics layer around in case it is needed again.&amp;nbsp; When I get a chance I will look into this more.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Sep 2013 18:26:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214608#M19872</guid>
      <dc:creator>DK5</dc:creator>
      <dc:date>2013-09-17T18:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: map.removeAllLayers Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214609#M19873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For a graphics layer, have you tried using the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
if (graphicsLayer != undefined)&amp;nbsp; graphicsLayer.clear()
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I used this plenty of times with my graphic layers and it works. I have to declare the graphic layer in the map initialization section so it is recognized through the rest of my code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:31:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214609#M19873</guid>
      <dc:creator>BetsySchenck-Gardner</dc:creator>
      <dc:date>2021-12-11T10:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: map.removeAllLayers Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214610#M19874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I am using the clear() method on the graphics layer to allow the user to clear all the graphics on the map - that way I don't have to remove any layers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2013 14:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-removealllayers-error/m-p/214610#M19874</guid>
      <dc:creator>DK5</dc:creator>
      <dc:date>2013-09-18T14:13:31Z</dc:date>
    </item>
  </channel>
</rss>

