<?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: How do I add a popup to every layer in a map service in 4.x? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1496886#M84918</link>
    <description>&lt;P&gt;Thanks so much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/377011"&gt;@MattStayner&lt;/a&gt;!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2024 22:17:08 GMT</pubDate>
    <dc:creator>JohnLucotch2</dc:creator>
    <dc:date>2024-06-24T22:17:08Z</dc:date>
    <item>
      <title>How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1067610#M73466</link>
      <description>&lt;P&gt;How can I add a map service so that my users can click on features in the map service? In 3.x I used&amp;nbsp;&lt;STRONG&gt;ArcGISDynamicMapServiceLayer&lt;/STRONG&gt;. In 4.x I'm now using &lt;STRONG&gt;MapImageLayer&lt;/STRONG&gt; to load the map service. Is that correct? To enable the popup on my FeatureLayer I just added &lt;STRONG&gt;popupTemplate: {}&lt;/STRONG&gt;. You can't use that on MapImageLayer. What can I do to enable a popup?&lt;/P&gt;&lt;P&gt;FYI, I'm using a custom panel to show the information, so I don't actually need a popup, I just need&amp;nbsp;&lt;STRONG&gt;await view.popup.fetchFeatures(event)&lt;/STRONG&gt; to trigger.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 23:24:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1067610#M73466</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2021-06-11T23:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1067850#M73481</link>
      <description>&lt;P&gt;It looks like we have to configure popups for each sublayer. In my case I don't know all the sublayers beforehand; this code enables popups for every sublayer when the layer initially loads:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.when(() =&amp;gt; {
    layer.allSublayers.forEach((sublayer) =&amp;gt; {
        sublayer.popupEnabled = true;
    });
});&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 14 Jun 2021 12:43:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1067850#M73481</guid>
      <dc:creator>EthanBodin1</dc:creator>
      <dc:date>2021-06-14T12:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1068052#M73493</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/74137"&gt;@EthanBodin1&lt;/a&gt;&amp;nbsp;thanks for the help!&lt;/P&gt;&lt;P&gt;That wasn't exactly what I needed, but&amp;nbsp;&lt;STRONG&gt;allSublayers&amp;nbsp;&lt;/STRONG&gt;got me on the right path. It turns out, in may case any way,&amp;nbsp;&lt;STRONG&gt;popupEnabled&amp;nbsp;&lt;/STRONG&gt;was already&amp;nbsp;&lt;STRONG&gt;true&lt;/STRONG&gt;, it was just missing the&amp;nbsp;&lt;STRONG&gt;popupTemplate&lt;/STRONG&gt;. Here's what I ended up with:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layerToAdd.allSublayers.forEach((sublayer) =&amp;gt; {
  sublayer.popupEnabled = true // required to trigger info panel
  sublayer.popupTemplate = { // required to trigger info panel
    outFields: ['*'] // required to view all attributes in popup
  }
})&lt;/LI-CODE&gt;&lt;P&gt;Thanks again for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 18:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1068052#M73493</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2021-06-14T18:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1485597#M84805</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/377011"&gt;@MattStayner&lt;/a&gt;&amp;nbsp; On your code I'm assuming this is when you were adding a layer through code? I'm trying to get all the popups in the Map Image to turn on without having to format each popup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 18:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1485597#M84805</guid>
      <dc:creator>JohnLucotch2</dc:creator>
      <dc:date>2024-06-05T18:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1485688#M84807</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/326974"&gt;@JohnLucotch2&lt;/a&gt;&amp;nbsp;I actually put the code above inside a `.when` so it runs once the layer is added (see below). I hope that helps!&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layerToAdd.when(() =&amp;gt; {
   layerToAdd.allSublayers.forEach((sublayer) =&amp;gt; {
     sublayer.popupEnabled = true; // required to trigger info panel
     sublayer.popupTemplate = { // required to trigger info panel
       outFields: ["*"], // required to view all attributes in popup
      };
   });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 21:24:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1485688#M84807</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2024-06-05T21:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a popup to every layer in a map service in 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1496886#M84918</link>
      <description>&lt;P&gt;Thanks so much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/377011"&gt;@MattStayner&lt;/a&gt;!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 22:17:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-add-a-popup-to-every-layer-in-a-map/m-p/1496886#M84918</guid>
      <dc:creator>JohnLucotch2</dc:creator>
      <dc:date>2024-06-24T22:17:08Z</dc:date>
    </item>
  </channel>
</rss>

