<?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 Manually open Feature popup when recieve a message (from postmessage) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1028428#M71816</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to open the feature popup when my map is recieving a message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;window.addEventListener("message", function (event) {
   if (event?.data?.type === "external") {
      console.log(_getAllFeaturesRecursive(featureLayer,[]));
   }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By doing this, I know that I need to open my popup...&lt;/P&gt;&lt;P&gt;I was using a function "getAllFeaturesRecursives" that get all the features:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;          const _getAllFeaturesRecursive = (layer, featuresSoFar) =&amp;gt; {
          return layer
            .queryFeatures({
              start: featuresSoFar.length,
              num: layer.capabilities.query.maxRecordCount,
              outFields: ['*']
            })
            .then((results) =&amp;gt; {
              if (
                results.exceededTransferLimit &amp;amp;&amp;amp;
                results.exceededTransferLimit === true
              ) {
                return _getAllFeaturesRecursive(layer, [
                  ...featuresSoFar,
                  ...results.features
                ]);
              } else {
                var p = Promise.resolve([...featuresSoFar, ...results.features]).then((feat) =&amp;gt; {
                  console.log(feat[0]);
                  feat[0].layer.popupEnabled = false;
                  feat[0].layer.popupEnabled = true;
                });
              }
            });
          };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gheeks_0-1613724993733.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6407i30C265738D479924/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gheeks_0-1613724993733.png" alt="Gheeks_0-1613724993733.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I tried to put popupenable to true, but it seems to be true foreach layers...&lt;/P&gt;&lt;P&gt;Do you have any ideas to open the feature popup (with focus) manually (without direct events on the map?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2021 08:59:17 GMT</pubDate>
    <dc:creator>Gheeks</dc:creator>
    <dc:date>2021-02-19T08:59:17Z</dc:date>
    <item>
      <title>Manually open Feature popup when recieve a message (from postmessage)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1028428#M71816</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to open the feature popup when my map is recieving a message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;window.addEventListener("message", function (event) {
   if (event?.data?.type === "external") {
      console.log(_getAllFeaturesRecursive(featureLayer,[]));
   }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By doing this, I know that I need to open my popup...&lt;/P&gt;&lt;P&gt;I was using a function "getAllFeaturesRecursives" that get all the features:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;          const _getAllFeaturesRecursive = (layer, featuresSoFar) =&amp;gt; {
          return layer
            .queryFeatures({
              start: featuresSoFar.length,
              num: layer.capabilities.query.maxRecordCount,
              outFields: ['*']
            })
            .then((results) =&amp;gt; {
              if (
                results.exceededTransferLimit &amp;amp;&amp;amp;
                results.exceededTransferLimit === true
              ) {
                return _getAllFeaturesRecursive(layer, [
                  ...featuresSoFar,
                  ...results.features
                ]);
              } else {
                var p = Promise.resolve([...featuresSoFar, ...results.features]).then((feat) =&amp;gt; {
                  console.log(feat[0]);
                  feat[0].layer.popupEnabled = false;
                  feat[0].layer.popupEnabled = true;
                });
              }
            });
          };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gheeks_0-1613724993733.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6407i30C265738D479924/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gheeks_0-1613724993733.png" alt="Gheeks_0-1613724993733.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I tried to put popupenable to true, but it seems to be true foreach layers...&lt;/P&gt;&lt;P&gt;Do you have any ideas to open the feature popup (with focus) manually (without direct events on the map?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 08:59:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1028428#M71816</guid>
      <dc:creator>Gheeks</dc:creator>
      <dc:date>2021-02-19T08:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Manually open Feature popup when recieve a message (from postmessage)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1028660#M71822</link>
      <description>&lt;P&gt;You can call the .open() method of the mapView's popup and pass in the feature or content you want to display. Might be something like this...&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;mapView.popup.open({ location: feat[0].geometry, features: [feat[0]] });&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#popup" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#popup&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 19:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1028660#M71822</guid>
      <dc:creator>TommyBramble</dc:creator>
      <dc:date>2021-02-19T19:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Manually open Feature popup when recieve a message (from postmessage)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1031425#M71883</link>
      <description>&lt;P&gt;Hey, sorry for the late feedback, i was absent for a week.&lt;/P&gt;&lt;P&gt;I've tried your solution and it seems to works but not really, in fact, my feat[0}.geometry seems to be null...&lt;/P&gt;&lt;P&gt;That's weird.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 08:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1031425#M71883</guid>
      <dc:creator>Gheeks</dc:creator>
      <dc:date>2021-03-01T08:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Manually open Feature popup when recieve a message (from postmessage)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1031431#M71884</link>
      <description>&lt;P&gt;Hm...It seems there was a problem with my method to get features, and also it seems to be useless:&lt;/P&gt;&lt;P&gt;Solution:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;                var query = {
                  objectIds: [event.data.objectid],
                  outFields: ["*"],
                  returnGeometry: true
                };

                featureLayer.queryFeatures(query)
                  .then(function(response){
                    // close view popup if it is open
                    view.popup.close();
                    // Open the new popup
                    var feat = response.features[0];
                    view.popup.open({ location: feat.geometry, features: [feat] });
                  });
                // console&lt;/LI-CODE&gt;&lt;P&gt;Special thanks to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/35377"&gt;@TommyBramble&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 09:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/manually-open-feature-popup-when-recieve-a-message/m-p/1031431#M71884</guid>
      <dc:creator>Gheeks</dc:creator>
      <dc:date>2021-03-01T09:46:45Z</dc:date>
    </item>
  </channel>
</rss>

