<?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: How to get graphic id in reactiveUtils.watch view popup event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1372387#M83406</link>
    <description>&lt;P&gt;Sorry about that, I didn't test it before posting, and it appears that the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#visible" target="_self"&gt;visible&lt;/A&gt; property gets set before the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#selectedFeature" target="_self"&gt;selectedFeature&lt;/A&gt; property.&amp;nbsp; It looks like if you reverse things to watch selectedFeature instead, you get the expected reference:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.watch(() =&amp;gt; view.popup?.selectedFeature, (selectedFeature) =&amp;gt; {
	if ((selectedFeature) &amp;amp;&amp;amp; (view.popup.visible)) {
		console.info(view.popup.selectedFeature.getObjectId());
	}
});&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 19 Jan 2024 17:53:43 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2024-01-19T17:53:43Z</dc:date>
    <item>
      <title>How to get graphic id in reactiveUtils.watch view popup event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1371423#M83373</link>
      <description>&lt;P&gt;I have a problem when using&amp;nbsp;reactiveUtils.watch to monitor the view.popup. I need to catch the graphic id&amp;nbsp;&lt;/P&gt;&lt;P&gt;to do further customize action, but I didn't find out any infos just from view.popup object.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code snippet is as below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;reactiveUtils.watch(&lt;BR /&gt;&amp;nbsp; () =&amp;gt; view.popup.visible,&lt;BR /&gt;&amp;nbsp; (visible) =&amp;gt; {&lt;BR /&gt;&amp;nbsp; ///debugger;&lt;BR /&gt;&amp;nbsp; // console.log("view.popup = ");&lt;BR /&gt;&amp;nbsp; // console.info(view.popup);&lt;BR /&gt;&amp;nbsp; if (visible) {&amp;nbsp; &amp;nbsp;.... }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;And another problem is, when I try using other method to get the graphic, like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;// Event handler that fires each time an action is clicked.&lt;BR /&gt;reactiveUtils.on(&lt;BR /&gt;&amp;nbsp; () =&amp;gt; view.popup,&lt;BR /&gt;&amp;nbsp; "trigger-action",&lt;BR /&gt;&amp;nbsp; (event) =&amp;gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;console.log("event.action.id =" + event.action.id);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;when I use chrome to debug this, I found&amp;nbsp;reactiveUtils.on is not be called.&amp;nbsp; So, is there any good way to&amp;nbsp;&lt;/P&gt;&lt;P&gt;catch popupTemplate reactor's graphic id, this graphic is basically as following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;graphic = new Graphic({&lt;BR /&gt;&amp;nbsp;geometry: new geometry.Polygon({&lt;BR /&gt;&amp;nbsp;rings: coordinates,&lt;BR /&gt;&amp;nbsp;spatialReference: {&lt;BR /&gt;&amp;nbsp; wkid: 3826&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}),&lt;BR /&gt;&amp;nbsp;symbol: {&lt;BR /&gt;&amp;nbsp;type: "simple-fill",&lt;BR /&gt;&amp;nbsp;color: [255, 0, 0, 0.3], // Red color with 0.3 opacity&lt;BR /&gt;&amp;nbsp;outline: {&lt;BR /&gt;&amp;nbsp; color: [255, 0, 0], // Red color&lt;BR /&gt;&amp;nbsp; width: 1&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;},&lt;BR /&gt;&amp;nbsp;attributes: {&lt;BR /&gt;&amp;nbsp;Name: "simple-marker",&lt;BR /&gt;&amp;nbsp;Description: tableHTML&lt;BR /&gt;},&lt;BR /&gt;&amp;nbsp;popupTemplate: popupTemplate&lt;BR /&gt;});&lt;BR /&gt;graphic.geometry.id = "checking_graphic_1"&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 06:24:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1371423#M83373</guid>
      <dc:creator>AbramhumHsu</dc:creator>
      <dc:date>2024-01-18T06:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get graphic id in reactiveUtils.watch view popup event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1371785#M83385</link>
      <description>&lt;P&gt;You can get a reference to the popup's currently displayed graphic via the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#selectedFeature" target="_self"&gt;selectedFeature&lt;/A&gt; property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.watch(() =&amp;gt; view.popup?.visible, (visible) =&amp;gt; {
	if ((visible) &amp;amp;&amp;amp; (view.popup.selectedFeature)) {
		console.info(view.popup.selectedFeature.getObjectId());
	}
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 17:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1371785#M83385</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-01-19T17:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get graphic id in reactiveUtils.watch view popup event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1372053#M83395</link>
      <description>&lt;P&gt;after testify, the&amp;nbsp;view.popup.selectedFeature is always null, is there any other good way to meet that,&lt;/P&gt;&lt;P&gt;the way I use to add graphic is using graphicLayer,&amp;nbsp; thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 01:30:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1372053#M83395</guid>
      <dc:creator>AbramhumHsu</dc:creator>
      <dc:date>2024-01-19T01:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get graphic id in reactiveUtils.watch view popup event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1372387#M83406</link>
      <description>&lt;P&gt;Sorry about that, I didn't test it before posting, and it appears that the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#visible" target="_self"&gt;visible&lt;/A&gt; property gets set before the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#selectedFeature" target="_self"&gt;selectedFeature&lt;/A&gt; property.&amp;nbsp; It looks like if you reverse things to watch selectedFeature instead, you get the expected reference:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.watch(() =&amp;gt; view.popup?.selectedFeature, (selectedFeature) =&amp;gt; {
	if ((selectedFeature) &amp;amp;&amp;amp; (view.popup.visible)) {
		console.info(view.popup.selectedFeature.getObjectId());
	}
});&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Jan 2024 17:53:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-graphic-id-in-reactiveutils-watch-view/m-p/1372387#M83406</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-01-19T17:53:43Z</dc:date>
    </item>
  </channel>
</rss>

