<?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: Popup contents in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163115#M76981</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To combine the two, you will need to use a custom content element outside of the text element. Here's a working example:&amp;nbsp;&lt;A href="https://codepen.io/kekenes/pen/abEjpoY" target="_blank"&gt;https://codepen.io/kekenes/pen/abEjpoY&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The key code snippet is in the poupTemplate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const popupStreets = {
  "title": "Streets",
  "content": [{
    type: "text",
    text: "&amp;lt;b&amp;gt;USRN:&amp;lt;/b&amp;gt; {SITE_CODE}&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Street Name:&amp;lt;/b&amp;gt; {SITE_NAME}&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Town Name:&amp;lt;/b&amp;gt; {TOWN_NAME}"
  }, {
    type: "custom",
    creator: (graphic) =&amp;gt; {
      const location = view.popup.location;
      return `x: ${location.x}&amp;lt;br&amp;gt;y: ${location.y}`;
    }
  }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just keep the first content as a text element. Then add a custom element that defines a function. You can use this function do do whatever you need to in the popup that is "custom". In this case, you just want to return the popup location, which happens to be where the user clicked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 16:53:06 GMT</pubDate>
    <dc:creator>KristianEkenes</dc:creator>
    <dc:date>2022-04-11T16:53:06Z</dc:date>
    <item>
      <title>Popup contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163022#M76975</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a popup that displays coordinates and I'd like the popup to also display details of a feature if selected. I can get my popup to display the coordinates or the feature details but I'm missing the connection on how to get it to do both at the same time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My knowledge is fairly basic and I've cobbled together what I've currently got from other templates. I'm just missing the final piece in the jigsaw.&lt;/P&gt;&lt;P&gt;I got from here how to display the coordinates:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm aware that this line&amp;nbsp;&lt;SPAN&gt;disables the popup template for my features from automatically opening so it can do some calculations before displaying the coordinates &lt;/SPAN&gt;&amp;nbsp;view.popup.autoOpenEnabled = false;&amp;nbsp; &amp;nbsp;so if I toggle to true I can see my feature details but not the coordinates.&lt;/P&gt;&lt;P&gt;My full code is here:&amp;nbsp;&lt;A href="https://codepen.io/RFletERYC/pen/gOoLxGy" target="_blank"&gt;https://codepen.io/RFletERYC/pen/gOoLxGy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm guessing I need some sort of function in the code that follows (view.popup.open) to fire the template up as part of the click event for the coordinates?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITApplications_0-1649685483008.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38559i53299AD5F3FAD370/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITApplications_0-1649685483008.png" alt="ITApplications_0-1649685483008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The coordinates work great (flag set to false)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITApplications_1-1649685650762.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38560i0BB476CA23B03529/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITApplications_1-1649685650762.png" alt="ITApplications_1-1649685650762.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The popup template works great (flag set to true)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITApplications_2-1649685739773.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38561i68ADD91480CC6E02/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITApplications_2-1649685739773.png" alt="ITApplications_2-1649685739773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I combine two? Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 14:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163022#M76975</guid>
      <dc:creator>ITApplications</dc:creator>
      <dc:date>2022-04-11T14:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Popup contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163115#M76981</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To combine the two, you will need to use a custom content element outside of the text element. Here's a working example:&amp;nbsp;&lt;A href="https://codepen.io/kekenes/pen/abEjpoY" target="_blank"&gt;https://codepen.io/kekenes/pen/abEjpoY&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The key code snippet is in the poupTemplate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const popupStreets = {
  "title": "Streets",
  "content": [{
    type: "text",
    text: "&amp;lt;b&amp;gt;USRN:&amp;lt;/b&amp;gt; {SITE_CODE}&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Street Name:&amp;lt;/b&amp;gt; {SITE_NAME}&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Town Name:&amp;lt;/b&amp;gt; {TOWN_NAME}"
  }, {
    type: "custom",
    creator: (graphic) =&amp;gt; {
      const location = view.popup.location;
      return `x: ${location.x}&amp;lt;br&amp;gt;y: ${location.y}`;
    }
  }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just keep the first content as a text element. Then add a custom element that defines a function. You can use this function do do whatever you need to in the popup that is "custom". In this case, you just want to return the popup location, which happens to be where the user clicked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 16:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163115#M76981</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2022-04-11T16:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Popup contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163395#M76990</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Add the popup content to array in the Popup template. Please check the below example.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/popup-multipleelements/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/popup-multipleelements/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 09:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163395#M76990</guid>
      <dc:creator>MariaArockiyaStephenRaj</dc:creator>
      <dc:date>2022-04-12T09:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Popup contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163797#M76998</link>
      <description>&lt;P&gt;Hi Kristian&lt;/P&gt;&lt;P&gt;That's fantastic thank you. That gives me exactly what I want and I've certainly learnt something new!&lt;/P&gt;&lt;P&gt;I've now removed the view on click for the geometry as the custom element in the popup has rendered that obsolete.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 13:41:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163797#M76998</guid>
      <dc:creator>ITApplications</dc:creator>
      <dc:date>2022-04-13T13:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Popup contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163882#M77000</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the link, that is very useful for helping me with any further development.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 13:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popup-contents/m-p/1163882#M77000</guid>
      <dc:creator>ITApplications</dc:creator>
      <dc:date>2022-04-13T13:42:01Z</dc:date>
    </item>
  </channel>
</rss>

