<?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: Is it possible to put a legend widget in a container outside the viewDiv container? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599262#M86756</link>
    <description>&lt;P&gt;Yes, you can create a legend as a child of any pre-existing element.&amp;nbsp; The following example shows getting a reference to an existing element via document.getElementById:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const legend = new Legend({
  view: view,
  container: document.getElementById("sidebar")
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your example, the "sidebar" element needs to be created and added to the document &lt;STRONG&gt;before&lt;/STRONG&gt; creating the Legend though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Mar 2025 01:31:01 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2025-03-26T01:31:01Z</dc:date>
    <item>
      <title>Is it possible to put a legend widget in a container outside the viewDiv container?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599231#M86755</link>
      <description>&lt;P&gt;I want to place a legend div that I'm creating using the Legend widget in a HTML div that is not a child of the "viewDiv" element. Is this even possible? I really don't want to have a legend item floating around in my map div.&lt;/P&gt;&lt;P&gt;I have included a sample CodePen below for reference. I want the legend to go in the "sidebar" element.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/janzagar0/pen/dPyjeYR" target="_blank" rel="noopener"&gt;https://codepen.io/janzagar0/pen/dPyjeYR&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 23:10:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599231#M86755</guid>
      <dc:creator>janzagar_0</dc:creator>
      <dc:date>2025-03-25T23:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to put a legend widget in a container outside the viewDiv container?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599262#M86756</link>
      <description>&lt;P&gt;Yes, you can create a legend as a child of any pre-existing element.&amp;nbsp; The following example shows getting a reference to an existing element via document.getElementById:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const legend = new Legend({
  view: view,
  container: document.getElementById("sidebar")
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your example, the "sidebar" element needs to be created and added to the document &lt;STRONG&gt;before&lt;/STRONG&gt; creating the Legend though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 01:31:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599262#M86756</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2025-03-26T01:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to put a legend widget in a container outside the viewDiv container?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599779#M86761</link>
      <description>&lt;P&gt;Thank you Joel. I realized I was separately making a really basic CSS-related error and the issue has now been fixed.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 23:24:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-put-a-legend-widget-in-a/m-p/1599779#M86761</guid>
      <dc:creator>janzagar_0</dc:creator>
      <dc:date>2025-03-26T23:24:26Z</dc:date>
    </item>
  </channel>
</rss>

