<?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: JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654568#M61035</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The below sample shows how to set the renderer for individual sublayers. But to set the popup you would just add the popupTemplate property to the sublayers property too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-mapimagelayer-renderers"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-mapimagelayer-renderers&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Apr 2019 21:32:28 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2019-04-03T21:32:28Z</dc:date>
    <item>
      <title>JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654567#M61034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&amp;nbsp; Starting to look at using the 4.x JavaScript API.&amp;nbsp; I am looking to assign a popupTemplate to each layer within a map service.&amp;nbsp; Can I do this without having to add each individual feature layer to the map?&amp;nbsp; I have done this in the 3.x API.&amp;nbsp; Here is my sample below and this works well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;electricGPS = new&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ArcGISDynamicMapServiceLayer("https://arcgis03/arcgis/rest/services/Electric/ElectricGPS/MapServer", {&lt;BR /&gt; id: "Electric GPS",&lt;BR /&gt; visible: true,&lt;BR /&gt; outFields: ["*"]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Set Info Template for Electric GPS&lt;BR /&gt;electricGPS.setInfoTemplates({&lt;BR /&gt; 0: {infoTemplate: genericPointsInfoTemplate},&lt;BR /&gt; 1: {infoTemplate: poleAttachmentsInfoTemplate},&lt;BR /&gt; 2: {infoTemplate: poleInfoTemplate},&lt;BR /&gt; 3: {infoTemplate: pedestalInfoTemplate},&lt;BR /&gt; 4: {infoTemplate: propertyInfoTemplate},&lt;BR /&gt; 5: {infoTemplate: streetlightInfoTemplate},&lt;BR /&gt; 6: {infoTemplate: switchingFacilityInfoTemplate},&lt;BR /&gt; 7: {infoTemplate: transformerFacilityInfoTemplate},&lt;BR /&gt; 8: {infoTemplate: servicePointsInfoTemplate},&lt;BR /&gt; 9: {infoTemplate: anchorGuyInfoTemplate},&lt;BR /&gt; 10: {infoTemplate: PrimaryMeterInfoTemplate},&lt;BR /&gt; 11: {infoTemplate: genericLineInfoTemplate}, &lt;BR /&gt; 12: {infoTemplate: UGPrimaryInfoTemplate},&lt;BR /&gt; 13: {infoTemplate: UGSecondaryInfoTemplate},&lt;BR /&gt; 14: {infoTemplate: AreaGenericInfoTemplate}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would this work using the 4.x API?&amp;nbsp; Trying to find clues in the API reference.&amp;nbsp; Thank you for any information you can provide.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2019 21:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654567#M61034</guid>
      <dc:creator>IanPeebles</dc:creator>
      <dc:date>2019-04-03T21:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654568#M61035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The below sample shows how to set the renderer for individual sublayers. But to set the popup you would just add the popupTemplate property to the sublayers property too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-mapimagelayer-renderers"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-mapimagelayer-renderers&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2019 21:32:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654568#M61035</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-04-03T21:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654569#M61036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you much for the resources.&amp;nbsp; I tried this out and got it to work.&amp;nbsp; However, when using the sublayers, it seems to eliminate all the other layers, if you are only specifying one layer.&amp;nbsp; I guess it is all or nothing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the 3.x environment, I was able to specify the ID of the layer and assign a popup for it, while allowing all layers to display.&amp;nbsp; I guess I need to research this further...trying to learn the differences between the 3x and 4x API.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2019 13:45:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654569#M61036</guid>
      <dc:creator>IanPeebles</dc:creator>
      <dc:date>2019-04-04T13:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654570#M61037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;In 4.x Specifying sublayers is telling the API that you only want those specific sublayers to show in the view. If you want all the sublayers but what to only specify the popupTemplate for one then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;wait for the view to load and then use code like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;when&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;findSublayerById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;popupTemaplate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; blah&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:43:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654570#M61037</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T03:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript 4.11 - Looking to Assign PopupTemplate to Map Service Layer by ID Number</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654571#M61038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is exactly what I was looking for.&amp;nbsp; Thank you much!&amp;nbsp; I did learn more about the sublayers too &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;.&amp;nbsp; Here is my final coding structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Popup Definitions" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/441195_Popups4x.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2019 14:24:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-4-11-looking-to-assign-popuptemplate-to/m-p/654571#M61038</guid>
      <dc:creator>IanPeebles</dc:creator>
      <dc:date>2019-04-04T14:24:15Z</dc:date>
    </item>
  </channel>
</rss>

