<?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 Using Dom nodes in a popup content function (api v4.5) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345534#M31875</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Running into a couple of popup issues new in 4.5 api version. If I have a simple popup content function that returns a domnode, the domnode is refreshed every time the popup moves. This isn't a big deal for simple popup contents, but if I have a 3rd party javascript library working in the popup, it breaks because the element is removed/reinserted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/anon/pen/WZJaBj?editors=0010" style="color: #2989c5; text-decoration: none;" title="https://codepen.io/anon/pen/WZJaBj?editors=0010"&gt;https://codepen.io/anon/pen/WZJaBj?editors=0010&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone have some suggestions on how to workaround this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Oct 2017 15:21:33 GMT</pubDate>
    <dc:creator>GreggRoemhildt1</dc:creator>
    <dc:date>2017-10-10T15:21:33Z</dc:date>
    <item>
      <title>Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345534#M31875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Running into a couple of popup issues new in 4.5 api version. If I have a simple popup content function that returns a domnode, the domnode is refreshed every time the popup moves. This isn't a big deal for simple popup contents, but if I have a 3rd party javascript library working in the popup, it breaks because the element is removed/reinserted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/anon/pen/WZJaBj?editors=0010" style="color: #2989c5; text-decoration: none;" title="https://codepen.io/anon/pen/WZJaBj?editors=0010"&gt;https://codepen.io/anon/pen/WZJaBj?editors=0010&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone have some suggestions on how to workaround this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:21:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345534#M31875</guid>
      <dc:creator>GreggRoemhildt1</dc:creator>
      <dc:date>2017-10-10T15:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345535#M31876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;This isn't a big deal for simple popup contents, but if I have a 3rd party javascript library working in the popup, it breaks because the element is removed/reinserted.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Could you go into more detail about this? &amp;nbsp;I can add an event listener to the node that gets inserted and that event listener will remain active after you pan the map around. &amp;nbsp;It's the same node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure why the content node is removed and then re-inserted as the map is panned. &amp;nbsp;This could be a bug or there might be a good reason for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The simplest workaround I can think of is just to add a setTimeout(()=&amp;gt;node.classList.remove('animated', 'fadeIn'), 1000) to your function. &amp;nbsp;1000 because the duration of the animation is 1000.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345535#M31876</guid>
      <dc:creator>ThomasSolow</dc:creator>
      <dc:date>2017-10-10T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345536#M31877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;Could you go into more detail about this?&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I'm rendering a component using Canjs into the popup. Its similar to how a react component works.The first time the template is viewed, it works well, even panning the map despite the dom node getting removed/inserted. But if I switch features and go back into the feature I previously visited, the template does not get rendered correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm assuming you might see the same thing with your event handler, if you toggle back and fourth between features, does it still work? I don't have a test case for this but that's what I'm seeing in my app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Oct 2017 17:06:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345536#M31877</guid>
      <dc:creator>GreggRoemhildt1</dc:creator>
      <dc:date>2017-10-10T17:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345537#M31878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My feeling is that&amp;nbsp;the most straightforward&amp;nbsp;way to do this would be&amp;nbsp;to write your own pop-up component using whichever JS framework you're using and use that instead of the standard popup template. &amp;nbsp;You may be able to use the popupViewModel to help out with this, though I haven't done that before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There may be a way to reliably render a third party component inside the popup reliably but my guess is that&amp;nbsp;it would be a pain and you're probably going to run into issues with it playing well with the popup.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Oct 2017 19:01:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345537#M31878</guid>
      <dc:creator>ThomasSolow</dc:creator>
      <dc:date>2017-10-10T19:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345538#M31879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;You may be able to use the popupViewModel to help out with this, though I haven't done that before.&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's an interesting idea, I'll have to look into that a bit. It would be ideal since, I don't want to have to re-write all of the popup positioning logic that comes with the api. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2017 15:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345538#M31879</guid>
      <dc:creator>GreggRoemhildt1</dc:creator>
      <dc:date>2017-10-18T15:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345539#M31880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey there, I'm curious whether you ended up re-writing the popup from scratch or whether you were able to leverage the popupViewModel. I'm in a similar situation... I'd love to&amp;nbsp;use a react component to render the popup content but I'd prefer not to lose the ESRI out-of-the-box popup positioning logic. Any advice you might have would be much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2019 19:24:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345539#M31880</guid>
      <dc:creator>NathanielRindlaub</dc:creator>
      <dc:date>2019-02-12T19:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using Dom nodes in a popup content function (api v4.5)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345540#M31881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;think I&amp;nbsp;answered my own question. For anyone interested, it's perfectly acceptable to render&amp;nbsp;react components using reactDOM.render() right in the popup's DOM node. Here's an &lt;A _jive_internal="true" href="https://community.esri.com/thread/227842-create-your-own-react-popup-component"&gt;example&lt;/A&gt; of that, and an&amp;nbsp;&lt;A href="https://reactjs.org/docs/integrating-with-other-libraries.html#integrating-with-other-view-libraries"&gt;explanation&lt;/A&gt; in React's docs confirming that that's a valid approach. I'm new to React and didn't know this, but to quote the docs, "Although React is commonly used at startup to load a single root React component into the DOM, ReactDOM.render() can also be called multiple times for independent parts of the UI which can be as small as a button, or as large as an app. In fact, this is exactly how React is used at Facebook."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2019 00:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-dom-nodes-in-a-popup-content-function-api-v4/m-p/345540#M31881</guid>
      <dc:creator>NathanielRindlaub</dc:creator>
      <dc:date>2019-02-13T00:48:08Z</dc:date>
    </item>
  </channel>
</rss>

