<?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: Dynamic Content in Popuptemplate in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183272#M77694</link>
    <description>&lt;P&gt;Is the "myCustomData" based on information from the feature? Based on the attributes? You could have that method be the content and create the elements when the popup opens. That would be the recommended way.&lt;/P&gt;&lt;P&gt;You can tweak that getDynamicContent method if you really need to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getDynamicContent(content) {
  return () =&amp;gt; {
    const div = document.createElement("div");
    div.innerHTML = content;
    return div;
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 19:33:02 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-06-15T19:33:02Z</dc:date>
    <item>
      <title>Dynamic Content in Popuptemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183233#M77686</link>
      <description>&lt;P&gt;I'm displaying popups with images that also have some JavaScript events associated with them (onmouseover, omouseout events). In order to get the JavaScript events through the sanitizer in v4.23, I dynamically create a DOM element for my content like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;popuptemplate.content = function(){

var div = document.createElement("div");
div.innerHTML = { my dynamic content, including the image URL, goes here };
return div;

}&lt;/LI-CODE&gt;&lt;P&gt;While this method outputs the events, it also preloads all of my images when the page loads (over 1000 images). I only want to load the image when the popup is clicked and still be able to keep my events associated with the image. How can I accomplish this?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 17:36:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183233#M77686</guid>
      <dc:creator>MikeV</dc:creator>
      <dc:date>2022-06-15T17:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Content in Popuptemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183245#M77687</link>
      <description>&lt;P&gt;What if you make the content function async? Seems odd that it loads all the images up front. I'd think the method only gets executed when the popup loads.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 17:51:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183245#M77687</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-06-15T17:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Content in Popuptemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183267#M77691</link>
      <description>&lt;P&gt;Let me clarify a bit regarding the way I'm trying to do this. I have a function that creates the div with the dynamic content:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getDynamicContent(content) {
    var div = document.createElement("div");
    div.innerHTML = content;
    return div;
}&lt;/LI-CODE&gt;&lt;P&gt;For each of my Graphic items, I create a popupTemplate and call my function like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (var i = 0; i &amp;lt; myCustomData.length; i++) {
 popuptemplate.content = getDynamicContent(myCustomData[i]);
 // code for initializing the point Graphic here.
 ...
}&lt;/LI-CODE&gt;&lt;P&gt;So I call getDynamicContent for each of my array items, one of which is an image URL, and it renders all the images as it loads the map--not when the popup is clicked. I'm sure there's something I can do differently with the way my JavaScript is structured but I'm not quite sure what that is.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183267#M77691</guid>
      <dc:creator>MikeV</dc:creator>
      <dc:date>2022-06-15T19:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Content in Popuptemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183272#M77694</link>
      <description>&lt;P&gt;Is the "myCustomData" based on information from the feature? Based on the attributes? You could have that method be the content and create the elements when the popup opens. That would be the recommended way.&lt;/P&gt;&lt;P&gt;You can tweak that getDynamicContent method if you really need to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getDynamicContent(content) {
  return () =&amp;gt; {
    const div = document.createElement("div");
    div.innerHTML = content;
    return div;
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:33:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183272#M77694</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-06-15T19:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Content in Popuptemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183279#M77698</link>
      <description>&lt;P&gt;Yes, using the arrow function allows the images to load when the popup is clicked instead of all at once when the page loads although I'm not clear why. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:44:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-content-in-popuptemplate/m-p/1183279#M77698</guid>
      <dc:creator>MikeV</dc:creator>
      <dc:date>2022-06-15T19:44:00Z</dc:date>
    </item>
  </channel>
</rss>

