<?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 cleared graphics re-appear in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316248#M29102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a graphics layer for the drawing toolbar tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var drawing = new esri.layers.GraphicsLayer({});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I call drawing.clear(); the graphics are removed from the screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but after I pan, zoom in / out, or try to print the graphics are visible again?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the strange thing is that drawing.graphics.length is zero.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is this a caching issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;my development site is at &lt;/SPAN&gt;&lt;A href="http://www.maps.ccgisc.org/test/"&gt;http://www.maps.ccgisc.org/test/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Jan 2011 21:19:27 GMT</pubDate>
    <dc:creator>Kathleen_Crombez</dc:creator>
    <dc:date>2011-01-13T21:19:27Z</dc:date>
    <item>
      <title>cleared graphics re-appear</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316248#M29102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a graphics layer for the drawing toolbar tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var drawing = new esri.layers.GraphicsLayer({});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I call drawing.clear(); the graphics are removed from the screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but after I pan, zoom in / out, or try to print the graphics are visible again?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the strange thing is that drawing.graphics.length is zero.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is this a caching issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;my development site is at &lt;/SPAN&gt;&lt;A href="http://www.maps.ccgisc.org/test/"&gt;http://www.maps.ccgisc.org/test/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 21:19:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316248#M29102</guid>
      <dc:creator>Kathleen_Crombez</dc:creator>
      <dc:date>2011-01-13T21:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: cleared graphics re-appear</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316249#M29103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I too ran across this last week. Everything looks fine in layout view and even the print preview, but when printing or exporting the mxd a previously deleted graphic reappears in the print copy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 13:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316249#M29103</guid>
      <dc:creator>JeffHoward</dc:creator>
      <dc:date>2011-01-17T13:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: cleared graphics re-appear</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316250#M29104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out what I was doing wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I was adding the graphic to the drawingGraphicsLayer I was calling drawingGraphicsLayer.add(map.graphics.add(graphic));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so essentially, I was adding the graphic to both the drawingGraphicsLayer and the default GraphicsLayer map.graphics&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the reason I did this was because I was calling map.addLayer(drawingGraphicsLayer); before the map was loaded which caused a JScript runtime error "this._cg._surface" is null or not an object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found the solution here: &lt;/SPAN&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=2396&amp;amp;t=284131&amp;amp;g=1" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.esri.com/Thread.asp?c=93&amp;amp;f=2396&amp;amp;t=284131&amp;amp;g=1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like (unlike most layers) you have to wait for the map to load before adding a new GraphicsLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;drawingGraphicsLayer = new esri.layers.GraphicsLayer();

dojo.connect(map, "onLoad", function() {
&amp;nbsp;&amp;nbsp; map.addLayer(drawingGraphicsLayer));
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:02:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cleared-graphics-re-appear/m-p/316250#M29104</guid>
      <dc:creator>Kathleen_Crombez</dc:creator>
      <dc:date>2021-12-11T15:02:08Z</dc:date>
    </item>
  </channel>
</rss>

